August 26, 2009 at 6:25 am
Pretty Good question! I liked it. Shows off some of the new enhancements in SQL2008...:-)
August 26, 2009 at 7:40 am
Interesting behaviour. If you change the last SET line to SET @msg = @msg+@msg+@msg then you get 111111 (at least you do with SQL Server 2005 SP3). Strange that you get an implicit conversion for multiplication but not for addition, which is interpreted as concatenation. I think I'd feel more comfortable if the multiplication failed with a "cannot convert" error.
John
August 26, 2009 at 7:48 am
It will actually generate an error.
August 26, 2009 at 10:08 am
anil
the statement below is same for sql server 2005
DECLARE @i AS INT
.
.
set @i =100;
.
.
SET @i =@i +25;
The difference in the statementl are:
DECLARE @i AS INT = 100 which combines the DECLARE and SET statements
SET @i +=25; --here the is no need to repeat the @i parameter
Combined these new features allow for less typing, and more readable code.
August 31, 2009 at 3:34 am
When u declaring local variable at the same statement u can't assign a value
e.g Declare @i as int = 100
it will give error,
u have to declare like
Declare @i as int
set @i=100
August 31, 2009 at 5:51 am
sur_manpower (8/31/2009)
When u declaring local variable at the same statement u can't assign a valuee.g Declare @i as int = 100
it will give error,
u have to declare like
Declare @i as int
set @i=100
to clarify - in SQL 2005 you can't
Declare @i as int = 100
But in SQL 2008 you can.
August 31, 2009 at 10:01 am
This is a new feature in SQL 2008
September 2, 2009 at 6:08 am
Easy one!
November 19, 2009 at 11:39 am
Hi,
I am having the same sort of problem, however with a linked server. We have a linked server setup to a Sybase server. Use the Sybase 15 SDK. Connection is using Microsoft ole db provider for ODBC. Works fine in SQL 2005. In SQL 2008 however I keep getting.
An error occurred while executing batch. Error message is: Invalid attempt to GetBytes on column 'Date'. The GetBytes function can only be used on columns of type Text, NText, or Image.
The only workaround I have is to either set the database compatibility level in SQL 2008 back to 90, and it works fine, or to convert the datetime field in my openquery statement before it comes back to SQL 2008. Ideally we don't want to set the database compatibility level back to 90, and would like to keep at 100.
Any ideas?
Jeremy
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply