March 31, 2006 at 6:20 am
Hi
i want to have one char from filed with data (nvarchar(50))
how can i do that;
March 31, 2006 at 6:32 am
An example please - of data and char to be extracted...
for instance if you're looking for 's' in a string, you'd do something like this:
declare @string nvarchar(50)
set @string = 'abcdefghijklmnopqrstuvwxyz'
select substring(@string, charindex('s', @string), 1)
**ASCII stupid question, get a stupid ANSI !!!**
March 31, 2006 at 6:44 am
ok
first filed @cul1 ='000000011111000'
i want to extract the number of first appear of '1' to fill it in another column
thanks
March 31, 2006 at 7:16 am
If I understand you correctly, you want the position of the first occurence of '1' in your string...if so, then..
declare @string nvarchar(50)
declare @position tinyInt
set @string = '000000011111000'
set @position = charindex('1', @string)
print @position
**ASCII stupid question, get a stupid ANSI !!!**
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply