Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Only Date portion of GetDate()
Message
From
22/10/2012 12:55:09
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01555465
Message ID:
01555468
Views:
47
Here's the SQL
insert into StudentLookup 
  Select SCN, Sname = (SLastName + ', ' + SFirstName), TCN, TName, chngdate = getdate()  from qryICECLExport
The error I'm getting is:

Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated.
The statement has been terminated.

I thought perhaps the SName field wasn't long enough, so I expanded it (still in development phase of project), but I'm still getting the error.


>>I only need the date portion of GetDate() as I want to insert today's date into a table. What's the best way to do this?
>>
>>Thanks
>
>Where you want to insert it?
>What type is that field?
>
>If the field is date type you don't need to do anything:
>
>DECLARE @Test TABLE (fld Date)
>INSERT INTO @Test VALUES (GETDATE())
>SELECT * FROM @Test
>
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform