I'm trying to declare a substring comand as a variable in T-SQL and use that variable to insert data into another column.
Is this possible? I have the following:
DECLARE @SQL2 varchar(3)
SET @SQL2= SELECT SUBSTRING("Policy No" , 3, 1)
FROM dbo.table1
SELECT "Policy No", @SQL2 AS Trim FROM dbo.table1
I should be left with results with 2 colums one with the policy number and the other with the trimmed version of the policy number
This totally does not work.I then want touse that variable to get a boolean response to whether it is an int or acharacter.
Unfortunately I have fallen at teh first hurdle. if anyone has any ideas on the first, second or both hurdles then please let me know. Itwould be most appreciated asthis office has no air conditioning and I'm getting hot and bothered lol.