嘗試執行SP時出現錯誤。請幫助將varchar值轉換爲int時轉換失敗
Conversion failed when converting the varchar value 'INSERT INTO INVESTOR_ACCOUNT VALUES('253361',' to data type int.
這是我的SP
ALTER Procedure [dbo].[RM_INVESTOR_ACCOUNTS_INSERT]
@AccountNo varchar(20), @InvestorID integer, @SaleDate datetime
As
Begin
declare @query nvarchar(max)
set @query ='INSERT INTO INVESTOR_ACCOUNT VALUES('''+ @AccountNo+ ''','[email protected]+','[email protected]+ ')'
print @query
End
下面命令
exec RM_INVESTOR_ACCOUNTS_INSERT '253361',1,'2003-12-24 00:00:00.000'
不需要鑄造/轉換嗎? – 2014-09-02 11:37:44
也需要轉換日期。你能告訴我如何轉換? – user3859666 2014-09-02 11:44:16
謝謝......但第二個(把日期值放在單引號中)不起作用 – user3859666 2014-09-02 12:00:58