Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with VB script for SQL server

Status
Not open for further replies.

pyroskliq

Technical User
Jan 17, 2001
29
0
0
US
My VB scripting isn't too good, and I'm trying to create a script for a data transformation in SQL server. The field that I'm transforming contains a combination of number and text. All are 4 characters long, such as 1000, 1100, 5000 etc. Some are 19XX or 11DX.

The script I am trying to create will update another field, so that if the record is a number and is between a certain range (such as >=1000 And <=5000 then the field will be an &quot;M&quot; and if the record is anything else (numeric or text) then the field will be an &quot;N&quot;.

Like I said, my scripting is pretty weak, and I'm fighting with the VB scripting users guide. Any help would be appreciated.

Brian
 
If your position is fixed, you may use the Mid$() Function to determine if the field contain characters.
Or you can use the IsNumeric() Function, it will return a boolean indicates true if ALL YOUR CHARACTERS are numeric else return false.
Then you can use the Val() Function that return the numeric value of your character field
Let me know if this help you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top