Tuesday, April 9, 2013

Find length of value in sql server

Here question is how to find result of particular length :

Here is one table employee

Create table employee(
Empid varchar(20),
Ename varchar(50)

)

Insert into employee(empid,ename)
Select 1233,x
Union
Select 1234,y
Union
Select 'E12256',z

Now we want to find out all employee of length 3 and is  numeric.

Then we can use len(field) function in sql server to find the length and can check numeric using isnumeric( field) function.

Here is our solution :

Select * from employee wherw len(empid)=3 and isnumeric(empid)

If any doubt pls revert...we will revert..

Tag: sql server and len function, isnumeric function


If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment