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
 General SQL Server Forums
 New to SQL Server Programming
 Does int DataType holds the value of String

Author  Topic 

Abid

110 Posts

Posted - 2013-04-13 : 00:59:15
Hi. I have a Table in SQL Server 2005 Standard, in which StID is a Primary Key, set to int DataType. When I insert the data from Front End, from VB.Net form, so i insert the String Value. right.

My question is that why it doesn't give any error, for sending string to DataType Int?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-13 : 01:44:01
may be because the string value contain only numeric data. It will work fine so far as the data can be converted to integer type.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Abid

110 Posts

Posted - 2013-04-13 : 06:58:07
But I did not use any conversion in my code. Does SQL automatically do this conversion
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-13 : 07:41:22
quote:
Originally posted by Abid

But I did not use any conversion in my code. Does SQL automatically do this conversion

Yes, it does. Se here http://msdn.microsoft.com/en-us/library/ms141260(v=sql.105).aspx
Go to Top of Page
   

- Advertisement -