Monday, March 26, 2012
Query Governor
Im setting up a SQL-Server and there is an option named Query
Governor to avoid queries to exceed a specific cost. How is this cost
measured ? Milliseconds ?
best regards,
Evandro
You can set this in enterprise manager under server properties using the
server settings tab.
Or
EXEC sp_configure 'show advanced option', '1'
exec sp_configure N'query governor cost limit', 100 (or the max elapsed time
in seconds)
http://www.schemamania.org/jkl/books..._server_51.htm
http://msdn.microsoft.com/library/de...onfig_73u6.asp
"Evandro Braga" <evandro_braga@.hotmail.com> wrote in message
news:eBM64z28EHA.1396@.tk2msftngp13.phx.gbl...
> Hello all,
> Im setting up a SQL-Server and there is an option named Query
> Governor to avoid queries to exceed a specific cost. How is this cost
> measured ? Milliseconds ?
>
> best regards,
> Evandro
>
|||Hi Evandro,
EXEC sp_configure N'query governor cost limit', 100 is a server-wide
setting. Unless you have a very specific reason, do not set this option.
At the client level, statementwise one can use
SET QUERY_GOVERNOR_COST_LIMIT
Thanks
Yogish
Query Governor
I´m setting up a SQL-Server and there is an option named Query
Governor to avoid queries to exceed a specific cost. How is this cost
measured ? Milliseconds ?
best regards,
EvandroYou can set this in enterprise manager under server properties using the
server settings tab.
Or
EXEC sp_configure 'show advanced option', '1'
exec sp_configure N'query governor cost limit', 100 (or the max elapsed time
in seconds)
http://www.schemamania.org/jkl/booksonline/SQLBOL70/html/1_server_51.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_config_73u6.asp
"Evandro Braga" <evandro_braga@.hotmail.com> wrote in message
news:eBM64z28EHA.1396@.tk2msftngp13.phx.gbl...
> Hello all,
> I´m setting up a SQL-Server and there is an option named Query
> Governor to avoid queries to exceed a specific cost. How is this cost
> measured ? Milliseconds ?
>
> best regards,
> Evandro
>|||Hi Evandro,
EXEC sp_configure N'query governor cost limit', 100 is a server-wide
setting. Unless you have a very specific reason, do not set this option.
At the client level, statementwise one can use
SET QUERY_GOVERNOR_COST_LIMIT
--
Thanks
Yogishsql
Query Governor
Im setting up a SQL-Server and there is an option named Query
Governor to avoid queries to exceed a specific cost. How is this cost
measured ? Milliseconds ?
best regards,
EvandroYou can set this in enterprise manager under server properties using the
server settings tab.
Or
EXEC sp_configure 'show advanced option', '1'
exec sp_configure N'query governor cost limit', 100 (or the max elapsed time
in seconds)
http://www.schemamania.org/jkl/book...1_server_51.htm
http://msdn.microsoft.com/library/d... />
g_73u6.asp
"Evandro Braga" <evandro_braga@.hotmail.com> wrote in message
news:eBM64z28EHA.1396@.tk2msftngp13.phx.gbl...
> Hello all,
> Im setting up a SQL-Server and there is an option named Query
> Governor to avoid queries to exceed a specific cost. How is this cost
> measured ? Milliseconds ?
>
> best regards,
> Evandro
>|||Hi Evandro,
EXEC sp_configure N'query governor cost limit', 100 is a server-wide
setting. Unless you have a very specific reason, do not set this option.
At the client level, statementwise one can use
SET QUERY_GOVERNOR_COST_LIMIT
Thanks
Yogish
Friday, March 23, 2012
Query for setting Cascade on Update in table relationships
I'm looking for a query I can use to alter table relationships. What I want to do in particular, is to set every relationship to cascade on update. Can anyone point me out to a solution? MSDN seems very vague in this subject.
Thanks,
Tiago
Write queries to drop the constraints and recreate them with the appropiate settings.
Jens K. Suessmeyer
http://www.sqlserver2005.de
This is not a data access question. Maybe you can put the question on SQL Server/TSQL forum
Wednesday, March 21, 2012
Query for Distinct Parameter with newest Date
I am having trouble setting up a query for my inspection test results for a given work piece.
Example Table [Inspection Data]
JOBSERIALPARAMMINMAXVALUEPFDATETIME
11Test101011F6/3/2007
11Test10105P6/4/2007
11Test2286P6/3/2007
11Test2281F6/4/2007
12Test10104P6/3/2007
12Test2285P6/4/2007
11Test3687P6/3/2007
Query table [Inspection Data] for:
JOB = 1
SERIAL = 1
MAX( DATETIME ) for each test
Expected Results:
JOBSERIALPARAMMINMAXVALUEPFDATETIME
11Test10105P6/4/2007
11Test2281F2/4/2007
11Test3687P6/3/2007
Thanks,
Sam
Here you go...
Code Snippet
Create Table #inspectiondata (
[JOB] int ,
[SERIAL] int ,
[PARAM] Varchar(100) ,
[MIN] int ,
[MAX] int ,
[VALUE] int ,
[PF] Varchar(100) ,
[DATETIME] Datetime
);
Insert Into #inspectiondata Values('1','1','Test1','0','10','11','F','6/3/2007');
Insert Into #inspectiondata Values('1','1','Test1','0','10','5','P','6/4/2007');
Insert Into #inspectiondata Values('1','1','Test2','2','8','6','P','6/3/2007');
Insert Into #inspectiondata Values('1','1','Test2','2','8','1','F','6/4/2007');
Insert Into #inspectiondata Values('1','2','Test1','0','10','4','P','6/3/2007');
Insert Into #inspectiondata Values('1','2','Test2','2','8','5','P','6/4/2007');
Insert Into #inspectiondata Values('1','1','Test3','6','8','7','P','6/3/2007');
--For SQL Server 2005
;With CTE
as
(
Select *, Row_Number() OVER(Partition By PARAM Order By [DATETIME] Desc) RowId From #inspectiondata
Where [JOB] = 1 And [SERIAL] = 1
)
Select
[JOB]
,[SERIAL]
,[PARAM]
,[MIN]
,[MAX]
,[VALUE]
,[PF]
,[DATETIME]
From
CTE
Where
RowId = 1
--For SQL Server 2000
Select
Data.[JOB]
,Data.[SERIAL]
,Data.[PARAM]
,Data.[MIN]
,Data.[MAX]
,Data.[VALUE]
,Data.[PF]
,Data.[DATETIME]
From
#inspectiondata Data
Join (
Select
Max([DateTime]) [DateTime]
,PARAM
From
#inspectiondata
Where
[JOB] = 1 And [SERIAL] = 1
Group By
PARAM
) as MaxData On MaxData.[DateTime] = Data.[DateTime] And MaxData.PARAM = Data.PARAM
Where
[JOB] = 1
And [SERIAL] = 1
|||
I was not familiar with CTEs until I read your posting and they seem very easy to read but I cannot get it to compile. The error I get if I name the CTE 'CTE' is 'CTE is not a recognized option'.
Are CTEs available with the Express version of SQL Server?
|||first google result would support thishttp://msdn2.microsoft.com/en-us/library/bb264566(SQL.90).aspx
Give the error of why it won't compile.|||
The reason why it was not working is because I had an alter procedure call at the beginning of the stored procedure.
Everything is working perfectly now.
Thank you for your help.
|||Also, The Alter Procedure call had to be moved to the first line in the sql code.
Thanks again,
Sam
Friday, March 9, 2012
query debugger?
stored procedures. I need a debugger so that I can set breakpoints, examine
variable values, etc.
Is there any way to get the SQL Server 2000 query debugger to work with
MSDE?
If not, would it be worthwhile to get the SQL Server 2000 developer edition
for $50?
T.I.A. for you suggestions.
hi Scott,
Scottww wrote:
> I'm setting up a learning environment at home so that I can learn to
> program stored procedures. I need a debugger so that I can set
> breakpoints, examine variable values, etc.
> Is there any way to get the SQL Server 2000 query debugger to work
> with MSDE?
> If not, would it be worthwhile to get the SQL Server 2000 developer
> edition for $50?
> T.I.A. for you suggestions.
long time ago a free debugger was available by Quest Software, SQL
Navigator, free but time bombed... now I'm no more able to find it on theyr
site... my best advice is SQL Server Dev edition ($50) which provides you
all the tools you ever need for SQL Server development, including Profiler
and Index Tuning...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply