Hello,
The output of the following query returns two identical
records, i need to eliminate all records that are
identical but if i use the "distinct" before the substring
function its returned one error.
This is the query that i'm using:
select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Tex
tdata),217)
as [TextData],
objid
into DestinationT
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star'
Thanks,
Best regardsDid you try using:
Select DISTINCT Derived.* into DestinationT FROM
( select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Tex
tdata),217) as [TextData],
objid
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star') Derived
... (untested)
WIll this help?
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:17fe001c44a19$f48dfb80$a301280a@.phx
.gbl...
> Hello,
> The output of the following query returns two identical
> records, i need to eliminate all records that are
> identical but if i use the "distinct" before the substring
> function its returned one error.
> This is the query that i'm using:
> select EvClassDesc,
> STime,
> substring(Textdata,patindex('%exec%',Tex
tdata),217)
> as [TextData],
> objid
> into DestinationT
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star'
> Thanks,
> Best regards|||Thanks Vinod
>--Original Message--
>Did you try using:
>Select DISTINCT Derived.* into DestinationT FROM
>( select EvClassDesc,
> STime,
> substring(Textdata,patindex('%
exec%',Textdata),217) as [TextData],
> objid
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star')
Derived
>... (untested)
>WIll this help?
>--
>HTH,
>Vinod Kumar
>MCSE, DBA, MCAD, MCSD
>http://www.extremeexperts.com
>Books Online for SQL Server SP3 at
>http://www.microsoft.com/sql/techin...ctdoc/2000/book
s.asp
>
>"CC&JM" <anonymous@.discussions.microsoft.com> wrote in
message
> news:17fe001c44a19$f48dfb80$a301280a@.phx
.gbl...
substring[vbcol=seagreen]
exec%',Textdata),217)[vbcol=seagreen]
>
>.
>
Showing posts with label distinct. Show all posts
Showing posts with label distinct. Show all posts
Friday, February 24, 2012
Eliminate records
Hello,
The output of the following query returns two identical
records, i need to eliminate all records that are
identical but if i use the "distinct" before the substring
function its returned one error.
This is the query that i'm using:
select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Textdata),217 )
as [TextData],
objid
into DestinationT
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star'
Thanks,
Best regards
Did you try using:
Select DISTINCT Derived.* into DestinationT FROM
( select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Textdata),217 ) as [TextData],
objid
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star') Derived
... (untested)
WIll this help?
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:17fe001c44a19$f48dfb80$a301280a@.phx.gbl...
> Hello,
> The output of the following query returns two identical
> records, i need to eliminate all records that are
> identical but if i use the "distinct" before the substring
> function its returned one error.
> This is the query that i'm using:
> select EvClassDesc,
> STime,
> substring(Textdata,patindex('%exec%',Textdata),217 )
> as [TextData],
> objid
> into DestinationT
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star'
> Thanks,
> Best regards
|||Thanks Vinod
>--Original Message--
>Did you try using:
>Select DISTINCT Derived.* into DestinationT FROM
>( select EvClassDesc,
> STime,
> substring(Textdata,patindex('%
exec%',Textdata),217) as [TextData],
> objid
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star')
Derived
>... (untested)
>WIll this help?
>--
>HTH,
>Vinod Kumar
>MCSE, DBA, MCAD, MCSD
>http://www.extremeexperts.com
>Books Online for SQL Server SP3 at
>http://www.microsoft.com/sql/techinf...tdoc/2000/book
s.asp
>
>"CC&JM" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:17fe001c44a19$f48dfb80$a301280a@.phx.gbl...
substring[vbcol=seagreen]
exec%',Textdata),217)
>
>.
>
The output of the following query returns two identical
records, i need to eliminate all records that are
identical but if i use the "distinct" before the substring
function its returned one error.
This is the query that i'm using:
select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Textdata),217 )
as [TextData],
objid
into DestinationT
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star'
Thanks,
Best regards
Did you try using:
Select DISTINCT Derived.* into DestinationT FROM
( select EvClassDesc,
STime,
substring(Textdata,patindex('%exec%',Textdata),217 ) as [TextData],
objid
from OriginalT
where objid = 1111111 and EvClassDesc = 'SP:Star') Derived
... (untested)
WIll this help?
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:17fe001c44a19$f48dfb80$a301280a@.phx.gbl...
> Hello,
> The output of the following query returns two identical
> records, i need to eliminate all records that are
> identical but if i use the "distinct" before the substring
> function its returned one error.
> This is the query that i'm using:
> select EvClassDesc,
> STime,
> substring(Textdata,patindex('%exec%',Textdata),217 )
> as [TextData],
> objid
> into DestinationT
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star'
> Thanks,
> Best regards
|||Thanks Vinod
>--Original Message--
>Did you try using:
>Select DISTINCT Derived.* into DestinationT FROM
>( select EvClassDesc,
> STime,
> substring(Textdata,patindex('%
exec%',Textdata),217) as [TextData],
> objid
> from OriginalT
> where objid = 1111111 and EvClassDesc = 'SP:Star')
Derived
>... (untested)
>WIll this help?
>--
>HTH,
>Vinod Kumar
>MCSE, DBA, MCAD, MCSD
>http://www.extremeexperts.com
>Books Online for SQL Server SP3 at
>http://www.microsoft.com/sql/techinf...tdoc/2000/book
s.asp
>
>"CC&JM" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:17fe001c44a19$f48dfb80$a301280a@.phx.gbl...
substring[vbcol=seagreen]
exec%',Textdata),217)
>
>.
>
Sunday, February 19, 2012
efficient SQL profiling
Hi,
Is there a way to efficiently monitor SQL performance using SQL Profiler,
and my meaning is to see distinct SQL query sent to server (by ignoring
parameter values sent with the queries)
this mean that query like
select * from users where user_id = 10
and
select * from users where user_id = 20
will be shown as the same query counted 2 times, and this way see which
query is performed mostly on the server, and priorities it's performance
tuning.
creative suggestions invited.
thanx.If it is simply the where clause that you are trying to eliminate, then why
not log all your queries to a SQL table and then do a select distinct from
the table, and get the substring of the query that does not include the
where clause?
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
news:Od5S7Gh%23DHA.3032@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Is there a way to efficiently monitor SQL performance using SQL Profiler,
> and my meaning is to see distinct SQL query sent to server (by ignoring
> parameter values sent with the queries)
> this mean that query like
> select * from users where user_id = 10
> and
> select * from users where user_id = 20
> will be shown as the same query counted 2 times, and this way see which
> query is performed mostly on the server, and priorities it's performance
> tuning.
> creative suggestions invited.
> thanx.
>
>|||Thanx,
2 points:
1. how do i log all my queries to the database in an encapsulated way?
1.1 can i also log this way the time it took to execute?
2. my buttleneck might also be a execute statement - well, this will go also
with your suggestion, just truncated before the starting '('.
"Aaron Relph" <x@.x.com> wrote in message
news:OAEHgVh%23DHA.3436@.tk2msftngp13.phx.gbl...
> If it is simply the where clause that you are trying to eliminate, then
why
> not log all your queries to a SQL table and then do a select distinct from
> the table, and get the substring of the query that does not include the
> where clause?
> "z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
> news:Od5S7Gh%23DHA.3032@.TK2MSFTNGP10.phx.gbl...
Profiler,
>|||This may help -
http://www.sql-server-performance.c...ofiler_tips.asp
Ray Higdon MCSE, MCDBA, CCNA
--
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
news:OQuACAi%23DHA.3292@.TK2MSFTNGP11.phx.gbl...
> Thanx,
> 2 points:
> 1. how do i log all my queries to the database in an encapsulated way?
> 1.1 can i also log this way the time it took to execute?
> 2. my buttleneck might also be a execute statement - well, this will go
also
> with your suggestion, just truncated before the starting '('.
>
>
> "Aaron Relph" <x@.x.com> wrote in message
> news:OAEHgVh%23DHA.3436@.tk2msftngp13.phx.gbl...
> why
from
> Profiler,
ignoring
which
performance
>
Is there a way to efficiently monitor SQL performance using SQL Profiler,
and my meaning is to see distinct SQL query sent to server (by ignoring
parameter values sent with the queries)
this mean that query like
select * from users where user_id = 10
and
select * from users where user_id = 20
will be shown as the same query counted 2 times, and this way see which
query is performed mostly on the server, and priorities it's performance
tuning.
creative suggestions invited.
thanx.If it is simply the where clause that you are trying to eliminate, then why
not log all your queries to a SQL table and then do a select distinct from
the table, and get the substring of the query that does not include the
where clause?
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
news:Od5S7Gh%23DHA.3032@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Is there a way to efficiently monitor SQL performance using SQL Profiler,
> and my meaning is to see distinct SQL query sent to server (by ignoring
> parameter values sent with the queries)
> this mean that query like
> select * from users where user_id = 10
> and
> select * from users where user_id = 20
> will be shown as the same query counted 2 times, and this way see which
> query is performed mostly on the server, and priorities it's performance
> tuning.
> creative suggestions invited.
> thanx.
>
>|||Thanx,
2 points:
1. how do i log all my queries to the database in an encapsulated way?
1.1 can i also log this way the time it took to execute?
2. my buttleneck might also be a execute statement - well, this will go also
with your suggestion, just truncated before the starting '('.
"Aaron Relph" <x@.x.com> wrote in message
news:OAEHgVh%23DHA.3436@.tk2msftngp13.phx.gbl...
> If it is simply the where clause that you are trying to eliminate, then
why
> not log all your queries to a SQL table and then do a select distinct from
> the table, and get the substring of the query that does not include the
> where clause?
> "z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
> news:Od5S7Gh%23DHA.3032@.TK2MSFTNGP10.phx.gbl...
Profiler,
>|||This may help -
http://www.sql-server-performance.c...ofiler_tips.asp
Ray Higdon MCSE, MCDBA, CCNA
--
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message
news:OQuACAi%23DHA.3292@.TK2MSFTNGP11.phx.gbl...
> Thanx,
> 2 points:
> 1. how do i log all my queries to the database in an encapsulated way?
> 1.1 can i also log this way the time it took to execute?
> 2. my buttleneck might also be a execute statement - well, this will go
also
> with your suggestion, just truncated before the starting '('.
>
>
> "Aaron Relph" <x@.x.com> wrote in message
> news:OAEHgVh%23DHA.3436@.tk2msftngp13.phx.gbl...
> why
from
> Profiler,
ignoring
which
performance
>
Subscribe to:
Posts (Atom)