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.
| Author |
Topic |
|
SqlZ
Yak Posting Veteran
69 Posts |
Posted - 2002-03-01 : 12:10:28
|
| I have a variable named and declared @A.How do I find if @A is at least 3 characters long?Something like IF @A< char(3)BEGINPrint 'small'ENDELSEBEGINPrint 'bigger than char(3)'ENDThis is probably very easy to do but I can't find out how. Thanks.========================My username represents the two things that consume most of my time.SQL, and my Z |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-03-01 : 12:15:59
|
| Use len()DECLARE @A varchar(50)SET @A = 'Hi'IF len(@A) < 3BEGINPrint 'small'ENDELSEBEGINPrint 'bigger than char(3)'ENDSET @A = 'Yaks are cool'IF len(@A) < 3BEGINPrint 'small'ENDELSEBEGINPrint 'bigger than char(3)'ENDMichael |
 |
|
|
SqlZ
Yak Posting Veteran
69 Posts |
Posted - 2002-03-01 : 12:18:21
|
| Thank you very much. :)I knew it was something simple.========================My username represents the two things that consume most of my time.SQL, and my Z |
 |
|
|
|
|
|