Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Variable value not set?

$
0
0
DECLARE @validation_message NVARCHAR(200)

BEGIN 
	SET @validation_message = @validation_message + 'test was here'
END

SELECT @validation_message

What silly mistake am I making?  Why is my variable value null?

However, If I change the code to this, I get the expected result

DECLARE @validation_message NVARCHAR(200)
SET @validation_message = ''
BEGIN 
	SET @validation_message = @validation_message + 'test was here'
END

SELECT @validation_message


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>