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
 Site Related Forums
 Article Discussion
 Article: Len() function in Select Statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-01 : 00:09:44
Maya writes "My select statement returns a resultset with one field, 'ResultText'. I would like to get a length of that field. Is there a way in SQL to do it like in Visual Basic ?"

Article Link.

Parax
Starting Member

3 Posts

Posted - 2003-05-30 : 11:13:04
Use {Code}Code here{/Code} tags to avoid forum errors!! (subst {} with [])

LEN('Joe   ')



For Padding I just use:
SELECT Format(intColumnName,'000000') FROM tblName
seems shorter still ;)

Go to Top of Page

cas_o
Posting Yak Master

154 Posts

Posted - 2003-05-30 : 12:49:37
WHAT?

format is a clause for database backups not a function, I can't make that work in query analyser, I thoght it looked to good to be true.

;-]
Go to Top of Page

killerguru
Starting Member

1 Post

Posted - 2004-04-20 : 05:38:39
select right(CONVERT(VARCHAR, (5+1000000000)),3)

A REALLY SIMPLE WAY TO PAD.

TRY IT OUT

:-))
Go to Top of Page

greg85374
Starting Member

8 Posts

Posted - 2004-07-16 : 15:34:23
Most often I see UNKNOWN or something similar in place of a null value. then in your code you ignore the UNKNOWN. There is no real reason I can think of you would EVER want to have a null value!
Go to Top of Page
   

- Advertisement -