Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql 2005 default value issue

Author  Topic 

xpandre
Posting Yak Master

212 Posts

Posted - 2009-01-09 : 04:50:30
Hi Guys,

I do the following steps in my sql 2005 server:

CREATE TABLE BBB(A VARCHAR(10))

ALTER TABLE BBB ADD CONSTRAINT DF_FOR_A
DEFAULT (left(replace(suser_sname(),'SAM\',''),50)) FOR A
GO


SP_HELP BBB


I get teh default value in the system as:
(left(replace(suser_sname(),'SAM\',''),(50)))

The 50 for left has come in brackets.
I tried the same in 2000 and it came as I inserted it..without the brackets.

Is this how it is in 2005 or have I done somethign wrong here?
Thanks
Sam

revelator
Starting Member

32 Posts

Posted - 2009-01-09 : 06:15:51
Does that actually cause you a problem though?

My question is (in this example), why are you trying to take the left 50 characters and insert it into a column with a size of 10...?

Waiting for the Great Leap Forwards
Go to Top of Page
   

- Advertisement -