Click here to Skip to main content
15,888,454 members
Home / Discussions / Database
   

Database

 
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 
AnswerRe: Accessing the file of a T-SQL BACKUP call Pin
scottgp2-Aug-09 14:34
professionalscottgp2-Aug-09 14:34 
GeneralRe: Accessing the file of a T-SQL BACKUP call Pin
Uwe Keim2-Aug-09 19:14
sitebuilderUwe Keim2-Aug-09 19:14 
AnswerRe: Accessing the file of a T-SQL BACKUP call Pin
Vimalsoft(Pty) Ltd3-Aug-09 4:50
professionalVimalsoft(Pty) Ltd3-Aug-09 4:50 
GeneralRe: Accessing the file of a T-SQL BACKUP call Pin
Uwe Keim3-Aug-09 6:00
sitebuilderUwe Keim3-Aug-09 6:00 
QuestionJoin performance Pin
Xmen Real 1-Aug-09 15:26
professional Xmen Real 1-Aug-09 15:26 
AnswerRe: Join performance Pin
Mycroft Holmes1-Aug-09 23:43
professionalMycroft Holmes1-Aug-09 23:43 
AnswerRe: Join performance Pin
Vimalsoft(Pty) Ltd2-Aug-09 21:46
professionalVimalsoft(Pty) Ltd2-Aug-09 21:46 
GeneralRe: Join performance Pin
Xmen Real 3-Aug-09 2:45
professional Xmen Real 3-Aug-09 2:45 
GeneralRe: Join performance Pin
Vimalsoft(Pty) Ltd3-Aug-09 3:07
professionalVimalsoft(Pty) Ltd3-Aug-09 3:07 
GeneralRe: Join performance Pin
Xmen Real 3-Aug-09 3:21
professional Xmen Real 3-Aug-09 3:21 
QuestionSQL query: Get correspondence descriptions instead foreign key IDs. Is that possible ? Pin
sdancer7531-Jul-09 5:00
sdancer7531-Jul-09 5:00 
AnswerRe: SQL query: Get correspondence descriptions instead foreign key IDs. Is that possible ? Pin
Blue_Boy31-Jul-09 7:12
Blue_Boy31-Jul-09 7:12 
QuestionSQL SP exception: "Incorrect syntax near '-'" Pin
cdietschrun31-Jul-09 4:14
cdietschrun31-Jul-09 4:14 
AnswerRe: SQL SP exception: "Incorrect syntax near '-'" Pin
That's Aragon1-Aug-09 1:56
That's Aragon1-Aug-09 1:56 

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.