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 |
Pregz
Starting Member
2 Posts |
Posted - 2014-05-19 : 06:04:23
|
HiIs it possible to assign to a column a value passed as a parameter?When I run the proc I get the following error : Msg 245, Level 16, State 1, Procedure Transfer, Line 17Conversion failed when converting the varchar value '@ID' to data type int.Any help with be appreciated. ----####################################################USE [tbldata]GO/****** Object: StoredProcedure [dbo].[Transfer] Script Date: 05/19/2014 11:26:38 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[Transfer](@ID int)ASBEGINupdate tbldataset Status = '9999'where MessageID in (select top 5000 MessageIDfrom tbldata)update tbldataset Status = 0,tblID = '@ID'END----####################################################Thanks |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2014-05-19 : 06:31:07
|
Don't set the variable in single quotes. Too old to Rock'n'Roll too young to die. |
|
|
|
|
|