SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Access query conversion with isnumeric
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

madamvegas
Starting Member

USA
3 Posts

Posted - 05/10/2012 :  11:03:52  Show Profile  Reply with Quote
I have this access query that I need to convert to sql and not quite sure what to use.

UPDATE Attribute_Data
SET Attribute_Data.AttValue = Int([AttValue])
WHERE (((IsNumeric([AttValue]))=-1) AND ((Right([AttValue],2))=".0"))
OR (((IsNumeric([AttValue]))=-1) AND ((Right([AttValue],3))=".00"))
OR (((IsNumeric([AttValue]))=-1) AND ((Right([AttValue],4))=".000"))
OR (((IsNumeric([AttValue]))=-1) AND ((Right([AttValue],5))=".0000"))
OR (((IsNumeric([AttValue]))=-1) AND ((Right([AttValue],6))=".00000"))

Theresa Burk

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 05/10/2012 :  11:41:16  Show Profile  Reply with Quote
Something like this?
UPDATE Attribute_Data 
SET Attribute_Data.AttValue = CAST([AttValue] AS INT)
WHERE ISNUMERIC([AttValue]) = 1 AND FLOOR([AttValue]) = [AttValue]
Most people who work with relational databases such as SQL Server would advise against using entity-attribute type of data storage. So if you have an opportunity to redesign the tables that would be something to keep in mind.
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 05/10/2012 :  13:29:50  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
This may be helpful for you to reference:

http://weblogs.sqlteam.com/jeffs/archive/2007/03/30/Quick-Access-JET-SQL-to-T-SQL-Cheatsheet.aspx

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000