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
 SQL Server Development (2000)
 Using CAST or CONVERT in dynamic Update statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-29 : 21:11:01
Rod writes "I have a problem where I need to convert a datatype before it goes into (or while it is being built) an Update statement to the db that is being passed as a string (from ASP page).

The string goes:

strSQL = "UPDATE dbo.CAR SET " &_
"CAR_INIT='" & CAR_INIT & "', " &_

etc.

In a select statement, if I wanted to change CAR_INIT from varchar to money, I'd write SELECT CAST(CAR_INIT AS money) AS CAR_INIT

etc.

But I can't figure out how to get this into an update statement. Everything I try gives me back an error.

Any suggestions?"
   

- Advertisement -