SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


substring more than 4000 characters


substring more than 4000 characters

Author
Message
kkabdul
kkabdul
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 59
i have a data which has 8500 characters and i need the characters from 20 to 8350. how to do?
substring returns only 4000 characters.

please help
Chandru -734144
Chandru -734144
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 263
select substring(column_name,20,8340) from table_name

is the above one is not working for you ?

Thanks,
Chandru
andegre
andegre
Mr or Mrs. 500
Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)

Group: General Forum Members
Points: 567 Visits: 460
This is what I use, except it's for text data types. I thought that varchar (if that's what your field is set as) is a max lenght of 4000. Anyway, here's my script to output text that is more than 4000 characters.


Declare @ptr varbinary(16),
@length int,
@Search varchar(200)

Set @Search = 'Title: 29aa58348'
--Set @Search = 'Title: 29aa58348'

Select @length = DataLength(FODocument)
From Admin..PrintJob
Where DocumentName = @Search

Select @ptr = TextPtr(FODocument)
From Admin..PrintJob
Where DocumentName = @Search

--Select @Search As [SearchParameter], @length As [LengthOfField], @ptr As [PointLocation]

If @ptr IS NOT NULL
ReadText PrintJob.FODocument @ptr 0 @length


Chandru -734144
Chandru -734144
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 263
instead of going for varbinary or something you can use varchar(max).

Just try out that.

Thanks,
Chandru
Joie Andrew
Joie Andrew
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3153 Visits: 2032
You can use the substring function with text data, so you will not have to deal with text pointers. The only thing is that instead of specifying the offset as the start and length characters, it needs to be specified in bytes.

http://msdn.microsoft.com/en-us/library/ms187748(SQL.90).aspx

Joie Andrew
"Since 1982"
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search