这是我遇到问题的 T-SQL 代码datetime
打开@form_dates
从@form_dates 获取下一个到@cid、@regdate、@compdate/* 打印@regdate 打印@compdate 这在日期时间中正确具有值。例如:2012 年 3 月 28 日下午 6:03 打印@courseno */
而@@FETCH_STATUS = 0 开始 设置@SQL = N'update tblname set cs' + CAST (@cid AS VARCHAR(10)) + '_begin = @rstring, cs' + CAST (@cid AS VARCHAR(10))+ '_end = @cstring where UserID = '+ CAST (@tempID 作为 VARCHAR(10))
声明 @ParmDefinition nvarchar(500) SET @ParmDefinition = N'@rstring 日期时间,@cstring 日期时间'
执行 sp_ExecuteSQL @SQL,@ParmDefinition, @rstring = @regdate,@cstring = @compdate
I have the values of
@regdate
and@compdate
fetched from a cursor and are of the format Jan 3 2012 2:30PM Mar 28 2012 6:03PM but these values are not reflecting in procedure output where I get the output:update tblname set cs32_begin = @rstring , cs32_end = @cstring where UserID = 419
谢谢。^