Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
macca
Posting Yak Master
146 Posts |
Posted - 2005-06-07 : 06:41:15
|
| I want to change the value of a variable in a table. I am using the set command but keep getting error. Here's my code:set deptid = '35' for Staff_tsfwhere staffno = '56'deptid and staffno are columns in the table staff.The error message is "Line 1: Incorrect syntax near '='."Anyone any ideas what i'm doing wrong?Thanks. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-07 : 06:47:41
|
| That should beUpdate Staff_tsf set deptid = '35' where staffno = '56'MadhivananFailing to plan is Planning to fail |
 |
|
|
macca
Posting Yak Master
146 Posts |
Posted - 2005-06-07 : 07:01:39
|
| Thanks for the reply, I should've known that, brain not workin or something. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-07 : 07:18:06
|
Well. Take relax and have cup of coffee MadhivananFailing to plan is Planning to fail |
 |
|
|
zokho
Starting Member
10 Posts |
Posted - 2005-06-07 : 19:01:49
|
| HIthe SET comand id used for variables and variable have to have @or@@ before their nameand for your question i suggest you to use UPDATE TableName SET RecordName=NewValue WHERE staffno='56'and be sure that staffno is a varchar()datatype not INTi hope my offer will be helpfullbabye |
 |
|
|
|
|
|