String or binary data would be truncated IN SQL Server Management Studio -


i have following table:

create table zain (   zid int not null,   cid varchar(2) not null,   name nvarchar(50)null,   hiredate date null ) 

when execute following insert statement error:

insert zain  values('12', 'asd', 'hohoo', 'jan-10-1999')  

the error is:

msg 8152, level 16, state 14, line 1
string or binary data truncated. statement has been terminated.

what doing wrong?

there issue insert statement

  1. the column zid int , passing 12 string '12' can remove ' won't give error.

  2. the column cid varchar(2) , trying insert 3 character string 'asd' give data truncation error. ie error here

  3. but if fix above error 1 pop-up conversion failed when converting date and/or time character string. date format giving hiredate column 'jan-10-1999'. sql can take date format in mm/dd/yyyy or yyyy-mm-dd etc. format specified cannot converted automatically date format sql. try 01/10/1999 or 1999-01-10..else try convert() function

msd doc convert function


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -