top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

convert NCHAR data type to INT

0 votes
45 views

How do i convert NCHAR data type to INT in sql server?

posted Apr 18, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote
 
Best answer

CREATE TABLE #Table(test nchar(3))

INSERT INTO #Table SELECT '111'

INSERT INTO #Table SELECT 'AAA'

INSERT INTO #Table SELECT '311'

SELECT CASE ISNUMERIC(test) WHEN 1 THEN CAST(test as int) ELSE 0 END FROM #Table

DROP TABLE #Table

answer Nov 12, 2014 by Manikandan J
Similar Questions
+3 votes

How to convert c # inline queries into stored procedure written in transact sql?

+3 votes

I have a table that looks something like this:

SetId ID Premium 
2012 5 Y 
2012 6 Y 
2013 5 N 
2013 6 N

I want to update the 2013 records with the premium values where the setid equals 2012.
So after the query it would look like this:

SetId ID Premium 
2012 5 Y
 2012 6 Y 
2013 5 Y 
2013 6 Y

Any help greatly appreciated

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...