2
我需要將MS Access數據庫代碼更改爲T-SQL代碼。將Access數據庫代碼更改爲T-SQL代碼
這是在MS Access的SQL:
SELECT Max("SPR-" & Val(Replace([RequestID],"SPR-",""))+1) AS AutoID
FROM Tb_Request
你有任何想法如何改變呢?
任何意見,將不勝感激:)
我需要將MS Access數據庫代碼更改爲T-SQL代碼。將Access數據庫代碼更改爲T-SQL代碼
這是在MS Access的SQL:
SELECT Max("SPR-" & Val(Replace([RequestID],"SPR-",""))+1) AS AutoID
FROM Tb_Request
你有任何想法如何改變呢?
任何意見,將不勝感激:)
如果2012+
Select AutoID = format(max(1+replace(RequestID,'SPR-','')),'SPR-#')
From @YourTable
如果預2012
Select AutoID = 'SPR-'+cast(max(1+replace(RequestID,'SPR-','')) as varchar(25))
From @YourTable