Click here to Skip to main content
15,896,269 members
Home / Discussions / Database
   

Database

 
GeneralCrystal Report with Ms SQL Server Pin
Member 367504722-Feb-08 0:58
Member 367504722-Feb-08 0:58 
GeneralAddress database schema Pin
pmpdesign21-Feb-08 15:44
pmpdesign21-Feb-08 15:44 
GeneralRe: Address database schema Pin
Christian Graus21-Feb-08 16:31
protectorChristian Graus21-Feb-08 16:31 
GeneralRe: Address database schema Pin
pmpdesign21-Feb-08 17:29
pmpdesign21-Feb-08 17:29 
GeneralRe: Address database schema Pin
Mark Churchill24-Feb-08 13:13
Mark Churchill24-Feb-08 13:13 
GeneralRe: Address database schema Pin
pmpdesign24-Feb-08 14:21
pmpdesign24-Feb-08 14:21 
GeneralRe: Address database schema Pin
GuyThiebaut21-Feb-08 22:29
professionalGuyThiebaut21-Feb-08 22:29 
GeneralIssue with Testing result of SQL SELECT Pin
Brian C Hart21-Feb-08 11:57
professionalBrian C Hart21-Feb-08 11:57 
Hello all,

I am a SQL newbie, so it's not obvious to me what I am doing wrong. Any help is very much appreciated. I am working in a stored procedure, and I want to run a T-SQL UPDATE statement if a certain field comes back as being NULL after doing a SELECT, or a different UPDATE otherwise.

What I have so far is:

ALTER PROCEDURE myProc

-- ...

32 IF @add_new_field = '1' --@add_new_field is a BIT parameter
33 BEGIN
34 IF (SELECT man.[notes] FROM [manhours] man WHERE man.[log_number] LIKE @log_number) IS NULL
35 UPDATE [manhours] SET [notes] = @notes WHERE [log_number] LIKE @log_number
36 ELSE
37 UPDATE [manhours] SET [notes] = [notes] || ' ' || @notes WHERE [log_number] LIKE @log_number
38 END

where the numbers on the left are line numbers. When I hit 'Execute' the following error occurs:

Msg 170, Level 15, State 1, Procedure uspSaveNotes, Line 34
Line 34: Incorrect syntax near '|'

I am a SQL newbie, so it's not obvious to me what I am doing wrong. Any help is very much appreciated.

Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
QuestionRe: Issue with Testing result of SQL SELECT Pin
pmarfleet21-Feb-08 12:38
pmarfleet21-Feb-08 12:38 
GeneralRe: Issue with Testing result of SQL SELECT Pin
Hesham Amin21-Feb-08 22:33
Hesham Amin21-Feb-08 22:33 
GeneralPlease, Someone help me to solve this problem as soon as possible!!! Pin
yunussheikh200721-Feb-08 6:48
yunussheikh200721-Feb-08 6:48 
GeneralRe: Please, Someone help me to solve this problem as soon as possible!!! Pin
Hesham Amin21-Feb-08 9:51
Hesham Amin21-Feb-08 9:51 
GeneralRe: Please, Someone help me to solve this problem as soon as possible!!! Pin
Christian Graus21-Feb-08 16:14
protectorChristian Graus21-Feb-08 16:14 
GeneralRe: Please, Someone help me to solve this problem as soon as possible!!! Pin
ChandraRam25-Feb-08 0:59
ChandraRam25-Feb-08 0:59 
GeneralCeating Trigger Pin
kibromg21-Feb-08 6:24
kibromg21-Feb-08 6:24 
GeneralRe: Ceating Trigger Pin
Hesham Amin21-Feb-08 9:40
Hesham Amin21-Feb-08 9:40 
QuestionUpdate with two tables, a correlated subquery? Pin
Ben Dessau21-Feb-08 5:06
Ben Dessau21-Feb-08 5:06 
AnswerRe: Update with two tables, a correlated subquery? Pin
Mike Dimmick22-Feb-08 1:09
Mike Dimmick22-Feb-08 1:09 
Questionhow to convert char to time Pin
Sachin Pimpale20-Feb-08 23:09
Sachin Pimpale20-Feb-08 23:09 
AnswerRe: how to convert char to time Pin
Hesham Amin21-Feb-08 9:50
Hesham Amin21-Feb-08 9:50 
GeneralSql Pin
senthilsstil20-Feb-08 21:19
senthilsstil20-Feb-08 21:19 
GeneralRe: Sql Pin
Hesham Amin21-Feb-08 9:35
Hesham Amin21-Feb-08 9:35 
GeneralRe: Sql Pin
Dave Kreskowiak21-Feb-08 9:44
mveDave Kreskowiak21-Feb-08 9:44 
QuestionHow do I update records in one table with values supplied by another. Pin
Steven J Jowett20-Feb-08 6:09
Steven J Jowett20-Feb-08 6:09 
AnswerRe: How do I update records in one table with values supplied by another. Pin
GuyThiebaut20-Feb-08 13:29
professionalGuyThiebaut20-Feb-08 13:29 

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.