Click here to Skip to main content
15,899,313 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
leckey3-Aug-09 8:54
leckey3-Aug-09 8:54 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Roberto Mazzone3-Aug-09 21:25
Roberto Mazzone3-Aug-09 21:25 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
David Skelly3-Aug-09 22:43
David Skelly3-Aug-09 22:43 
GeneralBuild your own identity value Pin
David Mujica4-Aug-09 2:58
David Mujica4-Aug-09 2:58 
GeneralRe: Build your own identity value [modified] Pin
Roberto Mazzone4-Aug-09 22:48
Roberto Mazzone4-Aug-09 22:48 
GeneralRe: Build your own identity value Pin
David Mujica5-Aug-09 2:59
David Mujica5-Aug-09 2:59 
GeneralRe: Build your own identity value Pin
Roberto Mazzone5-Aug-09 22:11
Roberto Mazzone5-Aug-09 22:11 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
Mike Ellison4-Aug-09 3:13
Mike Ellison4-Aug-09 3:13 
GeneralRe: How to check for a never populated table on sql server 2005 [modified] Pin
Roberto Mazzone4-Aug-09 22:51
Roberto Mazzone4-Aug-09 22:51 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Mike Ellison5-Aug-09 6:28
Mike Ellison5-Aug-09 6:28 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Roberto Mazzone5-Aug-09 22:08
Roberto Mazzone5-Aug-09 22:08 
QuestionNDoc to SQL scripts? Pin
devvvy3-Aug-09 5:43
devvvy3-Aug-09 5:43 
AnswerRe: NDoc to SQL scripts? Pin
leckey3-Aug-09 8:51
leckey3-Aug-09 8:51 
GeneralRe: NDoc to SQL scripts? Pin
devvvy3-Aug-09 14:51
devvvy3-Aug-09 14:51 
QuestionStored Procedure Pl/SQL Pin
Civic063-Aug-09 4:35
Civic063-Aug-09 4:35 
AnswerRe: Stored Procedure Pl/SQL Pin
Vimalsoft(Pty) Ltd3-Aug-09 4:47
professionalVimalsoft(Pty) Ltd3-Aug-09 4:47 
GeneralRe: Stored Procedure Pl/SQL Pin
Civic063-Aug-09 4:59
Civic063-Aug-09 4:59 
GeneralRe: Stored Procedure Pl/SQL Pin
Vimalsoft(Pty) Ltd3-Aug-09 5:06
professionalVimalsoft(Pty) Ltd3-Aug-09 5:06 
GeneralRe: Stored Procedure Pl/SQL Pin
Civic063-Aug-09 5:33
Civic063-Aug-09 5:33 
AnswerRe: Stored Procedure Pl/SQL Pin
David Skelly3-Aug-09 6:09
David Skelly3-Aug-09 6:09 
QuestionError in Stored Procedure. Pin
Satish - Developer3-Aug-09 3:29
Satish - Developer3-Aug-09 3:29 
AnswerRe: Error in Stored Procedure. Pin
Vimalsoft(Pty) Ltd3-Aug-09 4:38
professionalVimalsoft(Pty) Ltd3-Aug-09 4:38 
Good day Satish

Becacause of time i have, i will not write you a solution , but i will point to a problem

First you use one variable to do all things. Why do you create one variable that will hold the SQl statement and one to store the results
and evauate the result. i think you know what you are doing but you get confused by your code. declare another variable to hold the results after that you must test for only nulls and remove the quotes and try it like this


DECLARE @Result VARCHAR(MAX)
DECLARE @Final_Res VARCHAR(MAX)
Set @Result = (SELECT TOP 1 WITH TIES theCol FROM (SELECT * FROM Tbl_Origin WHERE Zip_Final =@Zipcode ) AS t1 UNPIVOT (theValue FOR theCol IN (@Querystr)) AS u1 ORDER BY theValue DESC)

IF @Result IS NULL 

Set @Result = 'Select Top 1 theCol from Tbl_Origin'

else 

select @Result 


Hope this Helps

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

Questiondesigning database tables to store data Pin
uglyeyes2-Aug-09 14:57
uglyeyes2-Aug-09 14:57 
AnswerRe: designing database tables to store data Pin
Henry Minute3-Aug-09 2:09
Henry Minute3-Aug-09 2:09 
QuestionAccessing the file of a T-SQL BACKUP call Pin
Uwe Keim2-Aug-09 5:52
sitebuilderUwe Keim2-Aug-09 5:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.