Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
coversion error while inserting value in...
coversion error while inserting value in datatype=Int column
Rate Topic
Display Mode
Topic Options
Author
Message
komal145
komal145
Posted Tuesday, September 25, 2012 10:46 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, March 19, 2013 1:38 PM
Points: 168,
Visits: 540
Hi...I am getting this message
Msg 245, Level 16, State 1, Line 7
Conversion failed when converting the varchar value 'd1867 ' to data type int.
Below is my code:----
INSERT INTO TableA(
ID
)
SELECT
Title
FROM #table
please help.
Post #1364181
komal145
komal145
Posted Tuesday, September 25, 2012 12:07 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, March 19, 2013 1:38 PM
Points: 168,
Visits: 540
I dont want to insert such columns.Please advice.
Post #1364217
Sean Lange
Sean Lange
Posted Tuesday, September 25, 2012 12:18 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:48 PM
Points: 8,979,
Visits: 8,539
komal145 (9/25/2012)
Hi...I am getting this message
Msg 245, Level 16, State 1, Line 7
Conversion failed when converting the varchar value 'd1867 ' to data type int.
Below is my code:----
INSERT INTO TableA(
ID
)
SELECT
Title
FROM #table
please help.
With no details to work with I am going to take a guess that your column ID is an int and you want to insert all rows from #table where Title is a valid int????
INSERT INTO TableA(
ID
)
SELECT
Title
FROM #table
where Title not like '%[^0-9]%'
Jeff Moden wrote a great spackle article about this very recently.
http://www.sqlservercentral.com/articles/IsNumeric/71512/
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1364228
komal145
komal145
Posted Wednesday, September 26, 2012 2:28 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, March 19, 2013 1:38 PM
Points: 168,
Visits: 540
Thank you .I filtered the title like isnumeric(title)=1
Post #1364930
Sean Lange
Sean Lange
Posted Wednesday, September 26, 2012 2:38 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:48 PM
Points: 8,979,
Visits: 8,539
komal145 (9/26/2012)
Thank you .I filtered the title like isnumeric(title)=1
If that is what you used it is obvious you didn't read that article very clearly. If this is a one time thing and it worked then that is great. But if you need to repeat this IsNumeric is NOT the way to find values that can't be converted to an int.
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1364933
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.