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 |
|
reddy_vam
Starting Member
43 Posts |
Posted - 2009-01-09 : 14:31:50
|
| Hi Guys,I have a question about using an OPENQUERY with the UPDATE SYNTAX. When i execute the below query i am getting the following error messagedeclare @PlanCode varchar(6)UPDATE OPENQUERY(ABC, 'SELECT * FROM ABC01.Package where status_id=1 and PLANNUMBER =' +char(39)+convert(varchar,@PlanCode)+char(39)) set status_id=3Error Message: 'Incorrect syntax near '+'. ' Please let me know if any one has any idea on it.Thanks,Vamshi |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-09 : 14:39:24
|
quote: Originally posted by reddy_vam Hi Guys,I have a question about using an OPENQUERY with the UPDATE SYNTAX. When i execute the below query i am getting the following error messagedeclare @PlanCode varchar(6)UPDATE OPENQUERY(ABC, 'SELECT * FROM ABC01.Package where status_id=1 and PLANNUMBER = @PlanCode' )set status_id=3Error Message: 'Incorrect syntax near '+'. ' Please let me know if any one has any idea on it.Thanks,Vamshi
|
 |
|
|
reddy_vam
Starting Member
43 Posts |
Posted - 2009-01-09 : 14:52:01
|
| Thanks for your reply Sodeep, I tried with the above code also, still i am getting the same type of error message.Thanks,Vamshi |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-01-09 : 14:57:43
|
the problem will be the variable handling.How to pass a variable to a linked server queryhttp://support.microsoft.com/kb/314520/en-ushope that helpsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|