I have the following code. When I run it, I get error messages saying that various fields for which the view is looking don't exist. I don't get any of the print statements. If I comment out the INSERT and SELECT statements, it runs fine but only prints the "That's all folks!" statement. The entire section should be skipped, which is what seems to be happening when the INSERT and SELECT statements are commented out. Why might this be happening?
Oh, I forgot. If I change the view to ...02, which will run correctly, it doesn't run at all; it just goes straight to "That's all folks!"
Oh, I forgot. If I change the view to ...02, which will run correctly, it doesn't run at all; it just goes straight to "That's all folks!"
Code:
DECLARE @VersionNumber INT
SET @VersionNumber = 2
DELETE dbo.Warranty
IF @VersionNumber < 2
BEGIN
PRINT ' Version < 2'
PRINT ' ' + CAST(@VersionNumber AS CHAR(1)) PRINT 'YOU WENT DOWN THE WRONG PATH!'
INSERT INTO dbo.Warranty
SELECT * FROM dbo.vwCMMSSrcWarranty00
END
PRINT 'That''s all folks!'