Hello,
I need to check for some records that are different, i
know that they exists but when i execute the following
query a lot of records are sent as result but i expect no
records returned.
I use this query:
select TextData, StartTime, EndTime
from dbo.SpExec
where EventClassDesc = 'SP:Starting' and
(substring(textdata,1,49) <>
substring('declare @.P1 bigint set @.P1=NULL exec
Content_Save',1,49))
When i separate these statements i verify that the output
is exacly the same and is for this reason that i expect no
records in the first query executed.
I put the queries and the results:
1st)
select substring(textdata, 1,49)
from dbo.SpExec
where objectid = xxx and EventClassDesc = 'SP:Starting'
res: declare @.P1 bigint set @.P1=NULL exec Content_Save
2nd)
select substring('declare @.P1 bigint set @.P1=NULL exec
Content_Save',1,49)
res: declare @.P1 bigint set @.P1=NULL exec Content_Save
It seems like the substring function adds an hiden
character in one of the statements that make that the
result is not being the desired result.
I really dont understand what is happening and i
appreciate if you can help me.
Best RegardsTry with:
select TextData, StartTime, EndTime
from dbo.SpExec
where EventClassDesc = 'SP:Starting' and
(substring(textdata,1,49) <>
substring(N'declare @.P1 bigint set @.P1=NULL exec
Content_Save',1,49))
Bojidar Alexandrov
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:172aa01c4489c$b36909c0$a101280a@.phx
.gbl...
> Hello,
> I need to check for some records that are different, i
> know that they exists but when i execute the following
> query a lot of records are sent as result but i expect no
> records returned.
> I use this query:
> select TextData, StartTime, EndTime
> from dbo.SpExec
> where EventClassDesc = 'SP:Starting' and
> (substring(textdata,1,49) <>
> substring('declare @.P1 bigint set @.P1=NULL exec
> Content_Save',1,49))
>
> When i separate these statements i verify that the output
> is exacly the same and is for this reason that i expect no
> records in the first query executed.
> I put the queries and the results:
> 1st)
> select substring(textdata, 1,49)
> from dbo.SpExec
> where objectid = xxx and EventClassDesc = 'SP:Starting'
> res: declare @.P1 bigint set @.P1=NULL exec Content_Save
> 2nd)
> select substring('declare @.P1 bigint set @.P1=NULL exec
> Content_Save',1,49)
> res: declare @.P1 bigint set @.P1=NULL exec Content_Save
> It seems like the substring function adds an hiden
> character in one of the statements that make that the
> result is not being the desired result.
> I really dont understand what is happening and i
> appreciate if you can help me.
> Best Regards|||Thanks Bojidar, but the result was exacly the same.
Best Regards
>--Original Message--
>Try with:
>select TextData, StartTime, EndTime
> from dbo.SpExec
> where EventClassDesc = 'SP:Starting' and
> (substring(textdata,1,49) <>
> substring(N'declare @.P1 bigint set @.P1=NULL exec
>Content_Save',1,49))
>
>Bojidar Alexandrov
>"CC&JM" <anonymous@.discussions.microsoft.com> wrote in
message
> news:172aa01c4489c$b36909c0$a101280a@.phx
.gbl...
no[vbcol=seagreen]
output[vbcol=seagreen]
no[vbcol=seagreen]
>
>.
>|||If you want an accurate answer, please provide DDL, sample data, and desired
results. Your description of the issue may sound good to you, but it's
difficult to solve a problem based solely on narrative.
http://www.aspfaq.com/5006
http://www.aspfaq.com/
(Reverse address to reply.)
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:172aa01c4489c$b36909c0$a101280a@.phx
.gbl...
> Hello,
> I need to check for some records that are different, i
> know that they exists but when i execute the following
> query a lot of records are sent as result but i expect no
> records returned.
> I use this query:
> select TextData, StartTime, EndTime
> from dbo.SpExec
> where EventClassDesc = 'SP:Starting' and
> (substring(textdata,1,49) <>
> substring('declare @.P1 bigint set @.P1=NULL exec
> Content_Save',1,49))
>
> When i separate these statements i verify that the output
> is exacly the same and is for this reason that i expect no
> records in the first query executed.
> I put the queries and the results:
> 1st)
> select substring(textdata, 1,49)
> from dbo.SpExec
> where objectid = xxx and EventClassDesc = 'SP:Starting'
> res: declare @.P1 bigint set @.P1=NULL exec Content_Save
> 2nd)
> select substring('declare @.P1 bigint set @.P1=NULL exec
> Content_Save',1,49)
> res: declare @.P1 bigint set @.P1=NULL exec Content_Save
> It seems like the substring function adds an hiden
> character in one of the statements that make that the
> result is not being the desired result.
> I really dont understand what is happening and i
> appreciate if you can help me.
> Best Regards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment