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 Database Dynamically

Author  Topic 

Kevmaster
Starting Member

3 Posts

Posted - 2005-05-13 : 16:13:49
Problem with some T-SQL code:



update report_sens_par_instruments
set @inst_typeVALUE = @RETURNSUM
where shift = @shiftAmt and currency = @currencyVALUE



@inst_typeVALUE is a varchar(30) variable that contains the name of a column in the table report_sens_par_instruments.
@RETURNSUM is created above and contains a float value

this is part of a while loop and each time @inst_typeVALUE changes.

however it gives me this error message when i try to run it:

Msg 257, Level 16, State 1:
Server 'Devel', Procedure 'kevinMoveTables', Line 58:
Implicit conversion from datatype 'FLOAT' to 'VARCHAR' is not allowed. Use the
CONVERT function to run this query.


i dont want to convert it because i am not putting a float into a varchar spot. simply, the name of the column is a varchar.


thanks for the help!

Kev

Kevmaster
Starting Member

3 Posts

Posted - 2005-05-13 : 16:15:14
subscribing
Go to Top of Page

Kevmaster
Starting Member

3 Posts

Posted - 2005-05-16 : 09:21:52
bump

any ideas?
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-05-16 : 09:32:56
I would hazard a guess that you need to do this part in dynamic SQL. BOL (Books On Line) can tell you how.

*need more coffee*
Go to Top of Page
   

- Advertisement -