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
 JS to SQL Function

Author  Topic 

gsgill76
Posting Yak Master

137 Posts

Posted - 2012-02-06 : 11:44:14
Hi
i want to convert ServiceTag Number into Express Service Code. the conversion i know in JavaScript as
expresscode = parseInt(servicetag, 36).toString().split("");


Can any one help me in converting this in SQL, may be SQL Function will be the best

Ref : http://www.windowsitpro.com/article/jscript/getting-the-dell-express-service-code

Thanks
Gurpreet Gill[url][/url][url][/url][url][/url][url][/url]

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-06 : 11:48:32
see the below for sql split function

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

gsgill76
Posting Yak Master

137 Posts

Posted - 2012-02-06 : 12:10:02
quote:
Originally posted by visakh16

see the below for sql split function

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Sorry this is of no use for me :(
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-06 : 13:39:50
quote:
Originally posted by gsgill76

quote:
Originally posted by visakh16

see the below for sql split function

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Sorry this is of no use for me :(


this does exactly what your js function does!

ie it splits the input string based on delimiter ie in your case pace

didnt understand what else you're asking for??

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-06 : 13:48:16
if you're looking for ParseInt part I think you need to write a udf for that

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

gsgill76
Posting Yak Master

137 Posts

Posted - 2012-02-06 : 13:49:21
Basically my JS code says that...
Convert BASE36 to BASE10
Rest is ok with me.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-06 : 14:02:52
so what you want is function for that?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -