Showing posts with label datatype. Show all posts
Showing posts with label datatype. Show all posts

Monday, March 26, 2012

How to Remove a charater from a SQL Data.

Dear Frineds

I have a hyperlink datatype column in Access database.I import that column into SQL Table.

Now my column in sql table say 'imp_cl 'have all data from Acces table.
But all record are prefix with"#" and at the end of value also have "#".
that means it imported in following way

eg. #//Server/image/img1.pdf#

Now I want to remove this # from both side.As we have around 80,000 record of same type,it is very difficult to do it record by record.

I would like to know aay fuction ,method or programme to remove this "#" from all record.

Thannk you

gracesonDECLARE @.c NVARCHAR(200)

SET @.c = '#//Server/image/img1.pdf#'

SELECT DataLength(@.c), @.c, SubString(@.c, 2, Datalength(@.c) / 2 - 2)
-PatP

Friday, February 24, 2012

How to Query to get the Numeric fields Only in the Table

hi Good Day everyone.

how can i query numeric values in the specific fields for example EmployeeID only.

but the field EmployeeID has a datatype of varchar.

for example :

EmployeeID -> Field

001

002

a

b

c

how do i query 001 and 002 only. tnx

here it is,

Code Snippet

Create Table #employee (

[EmployeeID] Varchar(100)

);

Insert Into #employee Values('001');

Insert Into #employee Values('002');

Insert Into #employee Values('a');

Insert Into #employee Values('b');

Insert Into #employee Values('c');

Insert Into #employee Values('1E2');

Insert Into #employee Values('.');

Insert Into #employee Values('$');

Insert Into #employee Values('E0');

Select

*

from

#employee

Where

Isnumeric([EmployeeID]) = 1

And [EmployeeID]not like '%[^0-9]%'

|||Thanks Manivannan.D.Sekaran it helps me a lot.