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 2005 Forums
 Transact-SQL (2005)
 HELP! UPDATE a column in SQL using SELECT CONVERT

Author  Topic 

KRichradson1127
Starting Member

20 Posts

Posted - 2009-07-31 : 15:25:04
I am currently populating an empty column in SQL using the following code:

update dbo.application
set company_id_mysql = (select convert(bigint, dbo.fn_hexStrToVarbin(a.new_client_id))
from [application] a
where a.application_id > 0)


Yet when I try to do this I get the following error message:
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.


All I want to do is take the data that I get from the SELECT CONVERT statement and have that data placed in the empty column that is filled with NULL values.

HELP!!!

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-07-31 : 15:27:26
Are you updating the same table?? If not, how are both the tables related...how can you join them?

EDIT: Maybe you need this

update dbo.application
set company_id_mysql = convert(bigint, dbo.fn_hexStrToVarbin(new_client_id)
where application_id > 0)
Go to Top of Page

KRichradson1127
Starting Member

20 Posts

Posted - 2009-07-31 : 15:44:17
They are the same table...
Go to Top of Page

KRichradson1127
Starting Member

20 Posts

Posted - 2009-07-31 : 15:46:43
Thanks....

Here is the right scripting:

update dbo.application
set company_id_mysql = convert(bigint, dbo.fn_hexStrToVarbin(new_client_id))



Go to Top of Page
   

- Advertisement -