|
-
August 16th, 2001, 07:01 AM
#1
Oracle function LPAD to MSSQL
Anyone know how to convert the (Oracle8) function LPAD (left-padding a field with specific characters) to MS SQL (7.0)?
MSN says "N/A" to LPAD/RPAD when comparing functions.
------------------
Karl, Denmark
---------
"..and may The Force be with you - too..."
[This message has been edited by kallikru (edited 08-17-2001).]
Karl, Denmark
---------
"..and may The Force be with you - too..."
-
August 17th, 2001, 04:37 AM
#2
^bump^
------------------
Karl, Denmark
---------
"..and may The Force be with you - too..."
Karl, Denmark
---------
"..and may The Force be with you - too..."
-
November 17th, 2008, 02:44 AM
#3
here we go......
using LPAD :
-----------
table users
-----------------|
|id | name |
|--------------- |
| 1 |liwa ganteng |
---------------- |
example oralce : select lpad(id,5,0), name from users
result : 00001 | liwa ganteng
example Ms SQL : select replicate(0,5-len(id))+id, name from users
result : 00001 | liwa ganteng
using RPAD :
-----------
example oralce : select rpad(id,5,0), name from users
result : 10000 | liwa ganteng
example Ms SQL : select id+replicate(0,5-len(id)), name from users
result : 10000 | liwa ganteng
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|