August 2, 2018 at 4:40 am
Hello,
I have a job reading a SQL server database that extracts the data into a txt file
However, I want to detect fields that contain quotation marks.
For example I am doing a test on the line in question (see capture).
That contains the value in quotation marks
I want to go back in an error file the line that contains a quoted value
I was thinking of counting the number of quotation marks on my line and see if there is a difference.However
I do not know how to count the number of quotation marks line by line.If you have a track?
Thanks in advanc
.
August 2, 2018 at 5:48 am
If you want to find a column that has a specific character you can use pat index
EG
Select * from mytable
where patindex('%["]%',my_column)>0
to count the number of occurrences of a character, sum the length of the string less the length of the string - your character
EG
declare @t varchar(10)
set @t='"AAbbbAA"'
select len(@t)-len(replace(@t,'"',''))
***The first step is always the hardest *******
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply