Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to implement this select statement

Status
Not open for further replies.

nomi2000

ISP
Feb 15, 2001
676
CA
Hi guys
i have a column "SYSB_Holidays" which is text data type and data like
"2003:01/01/2003,........."
now i want to eliminate the "2003:" part and select the rest of the dates how i can implement
select SUBSTRING(SYSB_Holidays,6, ?) FROM [dbo].[SysData]
in the length part its giving me error because its a text column
Regards
Nouman

Nouman Zaheer
Software Engineer
MSR
 
Try SELECT @Str = STUFF(SYSB_Holidays, 1, 5, '') FROM ...
or some adaptation form using the STUFF function. I am not sure if the fx works with TEXT datatypes, I am curious to know.
 
i saw something about READTEXT function that should do it.

hth's
 
Hi thanks for ur post but its not working
The BugStar ur suggestion not works as STUFF needs character or string datatype
patvos i saw READTEXT and it seems to be the way to go the following code is returning the characters from 6th to last position in SYSB_Holidays field

DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(SYSB_Holidays)
FROM SysData
READTEXT SysData.SYSB_Holidays @ptrval 6 108

Regards
Nouman


Nouman Zaheer
Software Engineer
MSR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top