txt粘貼SQL語句,取消{自動換行}再復制到SQL Manager里 query
sql server中拼接字符串時,需要把datetime型轉化為char型才能進行拼接。與int轉char類型不同,其需要多加引號:
例子:
declare @Dtime datetime
set @Dtime = '2020-03-05 14:16:36'
select 'INSERT into table1(pointID) VALUES ('+@Dtime+');'
1
2
錯誤提示:從字符串轉換日期和/或時間時,轉換失敗。 (241)
————————————————
