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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 UPDATE QUERY

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-14 : 08:32:55
moni writes "I have a question on the UPDATE query...this query is not working

update TABLENAME1 set PARAM1='SELECT * FROM TABLE2 WHERE PARAM2='XYZ' and PARAM3=PARAM4'

and PARAM1 is a varchar in the table structure.

This query is not working as we have 'SELECT and inside that PARAM2='XYZ

What is the best way to get rid of the error !! thanks for any response."

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-14 : 08:34:41
replace ' with ''

Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-03-14 : 08:45:37
Try this

update TABLENAME1 set PARAM1=(SELECT PARAM1 FROM TABLE2 WHERE PARAM2='XYZ' and PARAM3=PARAM4)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-14 : 08:49:11
i think she wants to store select statements into the column Param1...


Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-03-14 : 09:01:59
quote:
Originally posted by spirit1

i think she wants to store select statements into the column Param1...


Go with the flow & have fun! Else fight the flow


If so,

update TABLENAME1 set PARAM1='SELECT * FROM TABLE2 WHERE PARAM2=''XYZ'' and PARAM3=PARAM4'





Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -