Showing posts with label analyzer. Show all posts
Showing posts with label analyzer. Show all posts

Friday, March 23, 2012

How to test SP in SQL Server Express?

How can I test a stored proc that is in my SQL Server Express 2005 database? I don't see anything in VS 2005 or a Query Analyzer in SSMS express. ThanksYou can do it in two ways in Management Studio Express:

1. Go to Programmability > Stored Procedures in Object Explorer and then right-click the name of the stored procedure you wish to execute and choose 'Execute Stored Procecure...'

2. In SQL Query window type 'EXEC nameofprocedure param1, param2' etc. (Replacing your real values, of course!)sql

how to test a stored procedure in a sql query analyzer?

Hi,
How do we test a stored procedure in SQL Query Analyzer?
Thanks for hlep.
JasonYou execute stored procedures in T-SQL with the execute
<http://msdn.microsoft.com/library/e..._ea-ez_05ro.asp>
statement. For example,
exec dbo.MyProc MyInputParam1, MyInputParam2, MyOutputParam OUT
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Jason Huang wrote:

>Hi,
>How do we test a stored procedure in SQL Query Analyzer?
>Thanks for hlep.
>
>Jason
>
>|||You can also just open Query Analyzer - write the sp name and press the
green arrow execute button
Jack Vamvas
________________________________________
__________________________
SQL Server db administration - check www.ciquery.com/remotedba.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
> Hi,
> How do we test a stored procedure in SQL Query Analyzer?
> Thanks for hlep.
>
> Jason
>|||How about the "Ten Most Expensive Products" in Northwind?
I exec Ten Most Expensive Products, and it kept giving me an error message
saying some where wrong near Expensive.
"neu" <info@.nospam.com> glsD:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...[
vbcol=seagreen]
> You can also just open Query Analyzer - write the sp name and press the
> green arrow execute button
> Jack Vamvas
> ________________________________________
__________________________
> SQL Server db administration - check www.ciquery.com/remotedba.htm
> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>[/vbcol]|||EXEC "Ten Most Expensive Products"
or
EXEC [Ten Most Expensive Products]
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
> How about the "Ten Most Expensive Products" in Northwind?
> I exec Ten Most Expensive Products, and it kept giving me an error message
saying some where wrong
> near Expensive.
>
> "neu" <info@.nospam.com> glsD:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ib
s-infra.bt.com...
>|||Thanks Tibor.
This works!
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> glsD:%23uUJ5$Q4
FHA.1184@.TK2MSFTNGP12.phx.gbl...
> EXEC "Ten Most Expensive Products"
> or
> EXEC [Ten Most Expensive Products]
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
>|||Bartender, make the next one a double!
J.
On Fri, 4 Nov 2005 15:35:24 +0800, "Jason Huang"
<JasonHuang8888@.hotmail.com> wrote:

>Thanks Tibor.
>This works!
>"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> gl
sD:%23uUJ5$Q4FHA.1184@.TK2MSFTNGP12.phx.gbl...
>

how to test a stored procedure in a sql query analyzer?

Hi,
How do we test a stored procedure in SQL Query Analyzer?
Thanks for hlep.
Jason
You execute stored procedures in T-SQL with the execute
<http://msdn.microsoft.com/library/en...ea-ez_05ro.asp>
statement. For example,
exec dbo.MyProc MyInputParam1, MyInputParam2, MyOutputParam OUT
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Jason Huang wrote:

>Hi,
>How do we test a stored procedure in SQL Query Analyzer?
>Thanks for hlep.
>
>Jason
>
>
|||You can also just open Query Analyzer - write the sp name and press the
green arrow execute button
Jack Vamvas
__________________________________________________ ________________
SQL Server db administration - check www.ciquery.com/remotedba.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
> Hi,
> How do we test a stored procedure in SQL Query Analyzer?
> Thanks for hlep.
>
> Jason
>
|||How about the "Ten Most Expensive Products" in Northwind?
I exec Ten Most Expensive Products, and it kept giving me an error message
saying some where wrong near Expensive.
"neu" <info@.nospam.com> glsD:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ib s-infra.bt.com...
> You can also just open Query Analyzer - write the sp name and press the
> green arrow execute button
> Jack Vamvas
> __________________________________________________ ________________
> SQL Server db administration - check www.ciquery.com/remotedba.htm
> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>
|||EXEC "Ten Most Expensive Products"
or
EXEC [Ten Most Expensive Products]
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
> How about the "Ten Most Expensive Products" in Northwind?
> I exec Ten Most Expensive Products, and it kept giving me an error message saying some where wrong
> near Expensive.
>
> "neu" <info@.nospam.com> glsD:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ib s-infra.bt.com...
>
|||Thanks Tibor.
This works!
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> glsD:%23uUJ5$Q4FHA.1184@.TK2MSFTNGP12.phx .gbl...
> EXEC "Ten Most Expensive Products"
> or
> EXEC [Ten Most Expensive Products]
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
>
|||Bartender, make the next one a double!
J.
On Fri, 4 Nov 2005 15:35:24 +0800, "Jason Huang"
<JasonHuang8888@.hotmail.com> wrote:

>Thanks Tibor.
>This works!
>"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> glsD:%23uUJ5$Q4FHA.1184@.TK2MSFTNGP12.phx .gbl...
>

how to test a stored procedure in a sql query analyzer?

Hi,
How do we test a stored procedure in SQL Query Analyzer?
Thanks for hlep.
JasonThis is a multi-part message in MIME format.
--050700040106020402020601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
You execute stored procedures in T-SQL with the execute
<http://msdn.microsoft.com/library/en-us/tsqlref/ts_ea-ez_05ro.asp>
statement. For example,
exec dbo.MyProc MyInputParam1, MyInputParam2, MyOutputParam OUT
--
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Jason Huang wrote:
>Hi,
>How do we test a stored procedure in SQL Query Analyzer?
>Thanks for hlep.
>
>Jason
>
>
--050700040106020402020601
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>You execute stored procedures in T-SQL with the <a
href="http://links.10026.com/?link=execute</a>">http://msdn.microsoft.com/library/en-us/tsqlref/ts_ea-ez_05ro.asp">execute</a>
statement. For example,<br>
</tt>
<blockquote><tt>exec dbo.MyProc MyInputParam1, MyInputParam2,
MyOutputParam OUT</tt><br>
</blockquote>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2">blog:</font><font face="Tahoma" size="2"> <a
href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
<br>
Jason Huang wrote:
<blockquote cite="mid%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl"
type="cite">
<pre wrap="">Hi,
How do we test a stored procedure in SQL Query Analyzer?
Thanks for hlep.
Jason
</pre>
</blockquote>
</body>
</html>
--050700040106020402020601--|||You can also just open Query Analyzer - write the sp name and press the
green arrow execute button
Jack Vamvas
__________________________________________________________________
SQL Server db administration - check www.ciquery.com/remotedba.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
> Hi,
> How do we test a stored procedure in SQL Query Analyzer?
> Thanks for hlep.
>
> Jason
>|||How about the "Ten Most Expensive Products" in Northwind?
I exec Ten Most Expensive Products, and it kept giving me an error message
saying some where wrong near Expensive.
"neu" <info@.nospam.com> ¼¶¼g©ó¶l¥ó·s»D:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
> You can also just open Query Analyzer - write the sp name and press the
> green arrow execute button
> Jack Vamvas
> __________________________________________________________________
> SQL Server db administration - check www.ciquery.com/remotedba.htm
> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>> Hi,
>> How do we test a stored procedure in SQL Query Analyzer?
>> Thanks for hlep.
>>
>> Jason
>>
>|||EXEC "Ten Most Expensive Products"
or
EXEC [Ten Most Expensive Products]
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
> How about the "Ten Most Expensive Products" in Northwind?
> I exec Ten Most Expensive Products, and it kept giving me an error message saying some where wrong
> near Expensive.
>
> "neu" <info@.nospam.com> ¼¶¼g©ó¶l¥ó·s»D:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
>> You can also just open Query Analyzer - write the sp name and press the
>> green arrow execute button
>> Jack Vamvas
>> __________________________________________________________________
>> SQL Server db administration - check www.ciquery.com/remotedba.htm
>> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
>> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
>> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>> Hi,
>> How do we test a stored procedure in SQL Query Analyzer?
>> Thanks for hlep.
>>
>> Jason
>>
>>
>|||Thanks Tibor.
This works!
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> ¼¶¼g©ó¶l¥ó·s»D:%23uUJ5$Q4FHA.1184@.TK2MSFTNGP12.phx.gbl...
> EXEC "Ten Most Expensive Products"
> or
> EXEC [Ten Most Expensive Products]
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
> news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
>> How about the "Ten Most Expensive Products" in Northwind?
>> I exec Ten Most Expensive Products, and it kept giving me an error
>> message saying some where wrong near Expensive.
>>
>> "neu" <info@.nospam.com> ¼¶¼g©ó¶l¥ó·s»D:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
>> You can also just open Query Analyzer - write the sp name and press the
>> green arrow execute button
>> Jack Vamvas
>> __________________________________________________________________
>> SQL Server db administration - check www.ciquery.com/remotedba.htm
>> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
>> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
>> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>> Hi,
>> How do we test a stored procedure in SQL Query Analyzer?
>> Thanks for hlep.
>>
>> Jason
>>
>>
>>
>|||Bartender, make the next one a double!
J.
On Fri, 4 Nov 2005 15:35:24 +0800, "Jason Huang"
<JasonHuang8888@.hotmail.com> wrote:
>Thanks Tibor.
>This works!
>"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> ¼¶¼g©ó¶l¥ó·s»D:%23uUJ5$Q4FHA.1184@.TK2MSFTNGP12.phx.gbl...
>> EXEC "Ten Most Expensive Products"
>> or
>> EXEC [Ten Most Expensive Products]
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
>> news:eY1S9zQ4FHA.2432@.TK2MSFTNGP10.phx.gbl...
>> How about the "Ten Most Expensive Products" in Northwind?
>> I exec Ten Most Expensive Products, and it kept giving me an error
>> message saying some where wrong near Expensive.
>>
>> "neu" <info@.nospam.com> ¼¶¼g©ó¶l¥ó·s»D:dkeun3$nqk$1@.nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
>> You can also just open Query Analyzer - write the sp name and press the
>> green arrow execute button
>> Jack Vamvas
>> __________________________________________________________________
>> SQL Server db administration - check www.ciquery.com/remotedba.htm
>> SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
>> "Jason Huang" <JasonHuang8888@.hotmail.com> wrote in message
>> news:%238DlKHQ4FHA.2552@.TK2MSFTNGP10.phx.gbl...
>> Hi,
>> How do we test a stored procedure in SQL Query Analyzer?
>> Thanks for hlep.
>>
>> Jason
>>
>>
>>
>>
>

How to tell which port

I am having remote server which I cannot log through term
server or any other method so i need to depend on sql
query analyzer to do most things.
I need to determine the port that server is using ?
is there any method to do so within sql query analyzer?
Any thoughts?
apok wrote:
> I am having remote server which I cannot log through term
> server or any other method so i need to depend on sql
> query analyzer to do most things.
> I need to determine the port that server is using ?
> is there any method to do so within sql query analyzer?
> Any thoughts?
If you're using TCP-IP, then the default port is 1433.
David Gugick
Imceda Software
www.imceda.com
|||No but with mutiple instances you dont know which one is
being used so in that case how do know which port is used.
[vbcol=seagreen]
>--Original Message--
>apok wrote:
term
>If you're using TCP-IP, then the default port is 1433.
>--
>David Gugick
>Imceda Software
>www.imceda.com
>.
>
|||Hi
Take a look at SQLPing
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=26
John
|||Assuming you haven't cycled your errorlog since the last time you
started SQL server you could parse the errorlog into a tmp table and
grab it from there. Like this:
create table #tmp
(
line varchar(4000),
cont int
)
go
insert into #tmp (line, cont)
exec master.dbo.sp_readerrorlog
go
select line from #tmp
where line like '%SQL Server listening on%'
But that wouldn't work if you'd cycled your errorlog. Another way you
could do it would be to read the reg key it's stored in. Like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketNetLib\Tcp',
N'TcpPort'
For a default instance the reg key is different. Don't remember what
exactly, but it's something like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL
Server\MSSQL\MSSQLServer\SuperSocketNetLib\Tcp',
N'TcpPort'
However, the xp_regread xproc is undocumented and therefore likely to
changed (and therefore not recommended). In fact Microsoft changed its
behavior slightly in SQL 2000 SP4. Now, you can only read from certain
reg keys (it's a security thing), although these particular ones are OK
(by default). Also, the reg path for the TCP port is different for SQL
2005 so I wouldn't rely on that method too long.
There's a SQLDMO property (Registry2.TcpPort) for getting the port
number a SQL server is listening on. So you could write the query from
a DOS shell in VBScript or JScript or something like that.
HTH.
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
apok wrote:
[vbcol=seagreen]
>No but with mutiple instances you dont know which one is
>being used so in that case how do know which port is used.
>
>
>term
>

How to tell which port

I am having remote server which I cannot log through term
server or any other method so i need to depend on sql
query analyzer to do most things.
I need to determine the port that server is using ?
is there any method to do so within sql query analyzer?
Any thoughts?apok wrote:
> I am having remote server which I cannot log through term
> server or any other method so i need to depend on sql
> query analyzer to do most things.
> I need to determine the port that server is using ?
> is there any method to do so within sql query analyzer?
> Any thoughts?
If you're using TCP-IP, then the default port is 1433.
--
David Gugick
Imceda Software
www.imceda.com|||No but with mutiple instances you dont know which one is
being used so in that case how do know which port is used.
>--Original Message--
>apok wrote:
>> I am having remote server which I cannot log through
term
>> server or any other method so i need to depend on sql
>> query analyzer to do most things.
>> I need to determine the port that server is using ?
>> is there any method to do so within sql query analyzer?
>> Any thoughts?
>If you're using TCP-IP, then the default port is 1433.
>--
>David Gugick
>Imceda Software
>www.imceda.com
>.
>|||Hi
Take a look at SQLPing
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=26
John|||This is a multi-part message in MIME format.
--070705010300050106000600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Assuming you haven't cycled your errorlog since the last time you
started SQL server you could parse the errorlog into a tmp table and
grab it from there. Like this:
create table #tmp
(
line varchar(4000),
cont int
)
go
insert into #tmp (line, cont)
exec master.dbo.sp_readerrorlog
go
select line from #tmp
where line like '%SQL Server listening on%'
But that wouldn't work if you'd cycled your errorlog. Another way you
could do it would be to read the reg key it's stored in. Like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketNetLib\Tcp',
N'TcpPort'
For a default instance the reg key is different. Don't remember what
exactly, but it's something like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL
Server\MSSQL\MSSQLServer\SuperSocketNetLib\Tcp',
N'TcpPort'
However, the xp_regread xproc is undocumented and therefore likely to
changed (and therefore not recommended). In fact Microsoft changed its
behavior slightly in SQL 2000 SP4. Now, you can only read from certain
reg keys (it's a security thing), although these particular ones are OK
(by default). Also, the reg path for the TCP port is different for SQL
2005 so I wouldn't rely on that method too long.
There's a SQLDMO property (Registry2.TcpPort) for getting the port
number a SQL server is listening on. So you could write the query from
a DOS shell in VBScript or JScript or something like that.
HTH.
--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
apok wrote:
>No but with mutiple instances you dont know which one is
>being used so in that case how do know which port is used.
>
>
>>--Original Message--
>>apok wrote:
>>
>>I am having remote server which I cannot log through
>>
>term
>
>>server or any other method so i need to depend on sql
>>query analyzer to do most things.
>>I need to determine the port that server is using ?
>>is there any method to do so within sql query analyzer?
>>Any thoughts?
>>
>>If you're using TCP-IP, then the default port is 1433.
>>--
>>David Gugick
>>Imceda Software
>>www.imceda.com
>>.
>>
--070705010300050106000600
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Assuming you haven't cycled your errorlog since the last time you
started SQL server you could parse the errorlog into a tmp table and
grab it from there. Like this:<br>
<br>
create table #tmp<br>
(<br>
line varchar(4000),<br>
cont int<br>
)<br>
go<br>
<br>
insert into #tmp (line, cont)<br>
exec master.dbo.sp_readerrorlog<br>
go<br>
<br>
select line from #tmp<br>
where line like '%SQL Server listening on%'<br>
<br>
But that wouldn't work if you'd cycled your errorlog. Another way you
could do it would be to read the reg key it's stored in. Like this:<br>
<br>
exec master.dbo.xp_regread<br>
N'HKEY_LOCAL_MACHINE',<br>
N'Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketNetLib\Tcp',<br>
N'TcpPort'<br>
<br>
For a default instance the reg key is different. Don't remember what
exactly, but it's something like this:<br>
<br>
exec master.dbo.xp_regread<br>
N'HKEY_LOCAL_MACHINE',<br>
N'Software\Microsoft\Microsoft SQL
Server\MSSQL\MSSQLServer\SuperSocketNetLib\Tcp',<br>
N'TcpPort'<br>
<br>
However, the xp_regread xproc is undocumented and therefore likely to
changed (and therefore not recommended). In fact Microsoft changed its
behavior slightly in SQL 2000 SP4. Now, you can only read from certain
reg keys (it's a security thing), although these particular ones are OK
(by default). Also, the reg path for the TCP port is different for SQL
2005 so I wouldn't rely on that method too long.<br>
<br>
There's a SQLDMO property (Registry2.TcpPort) for getting the port
number a SQL server is listening on. So you could write the query from
a DOS shell in VBScript or JScript or something like that.<br>
<br>
HTH.<br>
</tt>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font> </span><b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"> <font face="Tahoma"
size="2">|</font><i><font face="Tahoma"> </font><font face="Tahoma"
size="2"> database administrator</font></i><font face="Tahoma" size="2">
| mallesons</font><font face="Tahoma"> </font><font face="Tahoma"
size="2">stephen</font><font face="Tahoma"> </font><font face="Tahoma"
size="2"> jaques</font><font face="Tahoma"><br>
</font><b><font face="Tahoma" size="2">T</font></b><font face="Tahoma"
size="2"> +61 (2) 9296 3668 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2"> F</font></b><font face="Tahoma" size="2"> +61
(2) 9296 3885 |</font><b><font face="Tahoma"> </font><font
face="Tahoma" size="2">M</font></b><font face="Tahoma" size="2"> +61
(408) 675 907</font><br>
<b><font face="Tahoma" size="2">E</font></b><font face="Tahoma" size="2">
<a href="http://links.10026.com/?link=mailto:mike.hodgson@.mallesons.nospam.com">
mailto:mike.hodgson@.mallesons.nospam.com</a> |</font><b><font
face="Tahoma"> </font><font face="Tahoma" size="2">W</font></b><font
face="Tahoma" size="2"> <a href="http://links.10026.com/?link=/">http://www.mallesons.com">
http://www.mallesons.com</a></font></span> </p>
</div>
<br>
<br>
apok wrote:
<blockquote cite="mid14e901c5196f$2e60d790$a501280a@.phx.gbl" type="cite">
<pre wrap="">No but with mutiple instances you dont know which one is
being used so in that case how do know which port is used.
</pre>
<blockquote type="cite">
<pre wrap="">--Original Message--
apok wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I am having remote server which I cannot log through
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!-->term
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">server or any other method so i need to depend on sql
query analyzer to do most things.
I need to determine the port that server is using ?
is there any method to do so within sql query analyzer?
Any thoughts?
</pre>
</blockquote>
<pre wrap="">If you're using TCP-IP, then the default port is 1433.
--
David Gugick
Imceda Software
<a class="moz-txt-link-abbreviated" href="http://links.10026.com/?link=www.imceda.com</a>">http://www.imceda.com">www.imceda.com</a>
.
</pre>
</blockquote>
</blockquote>
</body>
</html>
--070705010300050106000600--

How to tell which port

I am having remote server which I cannot log through term
server or any other method so i need to depend on sql
query analyzer to do most things.
I need to determine the port that server is using ?
is there any method to do so within sql query analyzer?
Any thoughts?apok wrote:
> I am having remote server which I cannot log through term
> server or any other method so i need to depend on sql
> query analyzer to do most things.
> I need to determine the port that server is using ?
> is there any method to do so within sql query analyzer?
> Any thoughts?
If you're using TCP-IP, then the default port is 1433.
David Gugick
Imceda Software
www.imceda.com|||No but with mutiple instances you dont know which one is
being used so in that case how do know which port is used.

>--Original Message--
>apok wrote:
term[vbcol=seagreen]
>If you're using TCP-IP, then the default port is 1433.
>--
>David Gugick
>Imceda Software
>www.imceda.com
>.
>|||Hi
Take a look at SQLPing
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=26
John|||Assuming you haven't cycled your errorlog since the last time you
started SQL server you could parse the errorlog into a tmp table and
grab it from there. Like this:
create table #tmp
(
line varchar(4000),
cont int
)
go
insert into #tmp (line, cont)
exec master.dbo.sp_readerrorlog
go
select line from #tmp
where line like '%SQL Server listening on%'
But that wouldn't work if you'd cycled your errorlog. Another way you
could do it would be to read the reg key it's stored in. Like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketNetLib\Tcp',
N'TcpPort'
For a default instance the reg key is different. Don't remember what
exactly, but it's something like this:
exec master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\Microsoft SQL
Server\MSSQL\MSSQLServer\SuperSocketNetL
ib\Tcp',
N'TcpPort'
However, the xp_regread xproc is undocumented and therefore likely to
changed (and therefore not recommended). In fact Microsoft changed its
behavior slightly in SQL 2000 SP4. Now, you can only read from certain
reg keys (it's a security thing), although these particular ones are OK
(by default). Also, the reg path for the TCP port is different for SQL
2005 so I wouldn't rely on that method too long.
There's a SQLDMO property (Registry2.TcpPort) for getting the port
number a SQL server is listening on. So you could write the query from
a DOS shell in VBScript or JScript or something like that.
HTH.
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
apok wrote:
[vbcol=seagreen]
>No but with mutiple instances you dont know which one is
>being used so in that case how do know which port is used.
>
>
>term
>sql

Wednesday, March 21, 2012

How to tell what version of SQL Server.

If I am running an MSDN version of SQL Server how would I be able to tell
using Query Analyzer?
I tried @.@.Version ... but it says Enterprise Edition ... when I know I have
install MSDN copy.
-LarsPlease check it out at the following link
http://sqljunkies.com/weblog/sqlpartner/posts/802.aspx
HTH
Satish Balusa
Corillian Corp.
"Lars Temme" <no_spam@.L+A+R+S.T+E+M+M+E@.fsc.fiserv.com> wrote in message
news:OgSYCYb6DHA.1592@.TK2MSFTNGP10.phx.gbl...
> If I am running an MSDN version of SQL Server how would I be able to tell
> using Query Analyzer?
> I tried @.@.Version ... but it says Enterprise Edition ... when I know I
have
> install MSDN copy.
> -Lars
>|||Still does not tell me whether server is running MSDN copy of SQL Server.
Perhaps this is not possiable.
-Lars
"Satish Balusa" <sbalusa_nospam@.corillian.com> wrote in message
news:%23RDv9cb6DHA.3860@.tk2msftngp13.phx.gbl...
> Please check it out at the following link
> http://sqljunkies.com/weblog/sqlpartner/posts/802.aspx
>
> --
> HTH
> Satish Balusa
> Corillian Corp.
>
> "Lars Temme" <no_spam@.L+A+R+S.T+E+M+M+E@.fsc.fiserv.com> wrote in message
> news:OgSYCYb6DHA.1592@.TK2MSFTNGP10.phx.gbl...
> > If I am running an MSDN version of SQL Server how would I be able to
tell
> > using Query Analyzer?
> > I tried @.@.Version ... but it says Enterprise Edition ... when I know I
> have
> > install MSDN copy.
> >
> > -Lars
> >
> >
>|||There's no such thing as an MSDN version of SQL Server. The MSDN people at MS quite simply shipped
MSDN with the edition they found most appropriate. In the beginning of SQL2K, you had all editions
and after a while the shipments only contained the developer edition.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Lars Temme" <no_spam@.L+A+R+S.T+E+M+M+E@.fsc.fiserv.com> wrote in message
news:ukZJsub6DHA.2064@.TK2MSFTNGP11.phx.gbl...
> Still does not tell me whether server is running MSDN copy of SQL Server.
> Perhaps this is not possiable.
> -Lars
> "Satish Balusa" <sbalusa_nospam@.corillian.com> wrote in message
> news:%23RDv9cb6DHA.3860@.tk2msftngp13.phx.gbl...
> > Please check it out at the following link
> >
> > http://sqljunkies.com/weblog/sqlpartner/posts/802.aspx
> >
> >
> > --
> > HTH
> > Satish Balusa
> > Corillian Corp.
> >
> >
> > "Lars Temme" <no_spam@.L+A+R+S.T+E+M+M+E@.fsc.fiserv.com> wrote in message
> > news:OgSYCYb6DHA.1592@.TK2MSFTNGP10.phx.gbl...
> > > If I am running an MSDN version of SQL Server how would I be able to
> tell
> > > using Query Analyzer?
> > > I tried @.@.Version ... but it says Enterprise Edition ... when I know I
> > have
> > > install MSDN copy.
> > >
> > > -Lars
> > >
> > >
> >
> >
>

How to tell if there is something in a binary field

I tried to upload a pdf file into a binary field using asp upload. I
cannot tell if there is anything in the field using query analyzer, and I wa
s
wondering what shows in the grid when something exists there. It is just
showing as <binary>Don't use a grid for this kind of thing.
SELECT DATALENGTH(col) FROM Table
This is my signature. It is a general reminder.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Linda Lalewicz" <LindaLalewicz@.discussions.microsoft.com> wrote in message
news:3208A836-96ED-406C-BF8A-305946E6BFE7@.microsoft.com...
>I tried to upload a pdf file into a binary field using asp upload. I
> cannot tell if there is anything in the field using query analyzer, and I
> was
> wondering what shows in the grid when something exists there. It is just
> showing as <binary>|||I also found that a select for that field would return something if there wa
s
something in there, if not it came back null.
Now I need to figure out why the clues that you gave me yesterday don't seem
to show me my pdf file. I just see a blank page with no errors, no pdf. :
(
wahhhh
"Aaron [SQL Server MVP]" wrote:

> Don't use a grid for this kind of thing.
> SELECT DATALENGTH(col) FROM Table
> --
> This is my signature. It is a general reminder.
> Please post DDL, sample data and desired results.
> See http://www.aspfaq.com/5006 for info.
>
>
> "Linda Lalewicz" <LindaLalewicz@.discussions.microsoft.com> wrote in messag
e
> news:3208A836-96ED-406C-BF8A-305946E6BFE7@.microsoft.com...
>
>sql

Monday, March 19, 2012

How to take back up using query analyzer

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
JyothiAnswered in microsoft.public.sqlserver.programming
Please do not multi-post.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:%23uGZUP%23$FHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>

How to take back up using query analyzer

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
Jyothi
Answered in microsoft.public.sqlserver.programming
Please do not multi-post.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:%23uGZUP%23$FHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>

How to take back up using query analyzer

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
JyothiAnswered in microsoft.public.sqlserver.programming
Please do not multi-post.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:%23uGZUP%23$FHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>

how to take back up

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
JyothiBACKUP DATABASE <dbname>
TO DISK = "d:\temp\backup.bak"
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:eA81FP%23$FHA.216@.TK2MSFTNGP15.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>|||Hi
Check out the description of the backup command in Books online or at
http://msdn.microsoft.com/library/d...asp?frame=true
John
"yoshitha" wrote:

> Hi
> Can anybody tell me how to take database back up using query analyzer in s
ql
> server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open enterpris
e
> manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and contac
t
> your system administrator"
> i can re-run setup but i need to take back up first and it is not giving a
ny
> error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>
>

Monday, March 12, 2012

how to surpress a server error msg?

background sql2k on nt5.
when using stored procedure sp_helprotect against a login. I've got the
following msg in query analyzer messages tab.
Server: Msg 15330, Level 11, State 1, Procedure sp_helprotect, Line 346
There are no matching rows on which to report.
is it possible to surpress that msg and just display the Grid tab?
thank you.
steveThat would be a client issue, but I assume that you are using QA and it does
n't have any awareness of any
particular stored procedures; it just displays whatever error comes back. On
e option can be to copy the source
code for the proc and modify it so it doesn't return that error message (I a
ssume that there's a RAISERROR
with that error somewhere in the source code).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"== Steve Pdx==" <lins@.nospam.portptld.com> wrote in message news:%23xdrpj0PEHA.640@.TK2MSFTN
GP12.phx.gbl...
> background sql2k on nt5.
> when using stored procedure sp_helprotect against a login. I've got the
> following msg in query analyzer messages tab.
> Server: Msg 15330, Level 11, State 1, Procedure sp_helprotect, Line 346
> There are no matching rows on which to report.
>
> is it possible to surpress that msg and just display the Grid tab?
> thank you.
>
> steve
>|||well, i'd rather not to change the system stored procedure since that would
mean i have to change that particular sp on all servers!
i'd prefer a solution to control the display.
i was calling the sp thru SQL pass thru in Access and return the query
result to display in an Access report. (the query set, not the error msg)
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OExOyt0PEHA.2236@.TK2MSFTNGP10.phx.gbl...
> That would be a client issue, but I assume that you are using QA and it
doesn't have any awareness of any
> particular stored procedures; it just displays whatever error comes back.
One option can be to copy the source
> code for the proc and modify it so it doesn't return that error message (I
assume that there's a RAISERROR
> with that error somewhere in the source code).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "== Steve Pdx==" <lins@.nospam.portptld.com> wrote in message
news:%23xdrpj0PEHA.640@.TK2MSFTNGP12.phx.gbl...
>|||As this is a client issue, I suggest you post the question to an Access grou
p. there might be some option in
Access to suppress error messages...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"== Steve Pdx==" <lins@.nospam.portptld.com> wrote in message news:eiigD40PEHA.3944@.tk2msftng
p13.phx.gbl...
> well, i'd rather not to change the system stored procedure since that woul
d
> mean i have to change that particular sp on all servers!
> i'd prefer a solution to control the display.
> i was calling the sp thru SQL pass thru in Access and return the query
> result to display in an Access report. (the query set, not the error msg)
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:OExOyt0PEHA.2236@.TK2MSFTNGP10.phx.gbl...
> doesn't have any awareness of any
> One option can be to copy the source
> assume that there's a RAISERROR
> news:%23xdrpj0PEHA.640@.TK2MSFTNGP12.phx.gbl...
>|||> well, i'd rather not to change the system stored procedure since that
would
> mean i have to change that particular sp on all servers!
What if you found a more serious error in your stored procedure? You should
be setting up your servers so that deploying changes is not so convoluted
and difficult that you find yourself looking for more convenient
workarounds. IMHO.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Friday, February 24, 2012

how to stop the query

Hi All,
I am executing one query in sql analyzer. It was taking too much of time.I am not able to stop the query using stop button,it was not responding.
Many users are working with that database at the same time,not possible to stop services(agent or server) also.

Any help from you.

Regards
Bharat

Quote:

Originally Posted by bharadwaj

Hi All,
I am executing one query in sql analyzer. It was taking too much of time.I am not able to stop the query using stop button,it was not responding.
Many users are working with that database at the same time,not possible to stop services(agent or server) also.

Any help from you.

Regards
Bharat


You could try to disconnect... FILE >> Disconnect

Sunday, February 19, 2012

How to stop query in QA from continuing

Greetings everyone!

Is there a way to stop query analyzer from processing remaining query
statements? Let's say i have the following query in query analyzer:

query statements
if condition
begin
query statements
stop the query
end

query statements
if condition
begin
query statements
stop the query
end

is there a way to stop the query from executing the statements in the
second query when the first condition is met?

i have searched BOL and google but i couldn't find anything. I hope
anybody out there can help me.

BTW, i'm executing this statements directly in QA, not from within my
program. The query statement and if condition pair is plenty. i guess i
can use an else statement but it would be nested too deep. if there is
a simpler way to do it please point me to the right direction or to any
link that'll get me going.

Thanks in advance.

diegoYou can use GOTO. It will look like this:

query statements
if condition
begin
query statements
GOTO ExitQuery
end

query statements
if condition
begin
query statements
GOTO ExitQuery
end

ExitQuery:
GO

Be aware that GOTO cannot go to a label outside of the batch.

Regards,

Plamen Ratchev
http://www.SQLStudio.com
"diego" <diegobph@.yahoo.comwrote in message
news:1168144191.844124.221930@.11g2000cwr.googlegro ups.com...

Quote:

Originally Posted by

Greetings everyone!
>
Is there a way to stop query analyzer from processing remaining query
statements? Let's say i have the following query in query analyzer:
>
query statements
if condition
begin
query statements
stop the query
end
>
query statements
if condition
begin
query statements
stop the query
end
>
is there a way to stop the query from executing the statements in the
second query when the first condition is met?
>
i have searched BOL and google but i couldn't find anything. I hope
anybody out there can help me.
>
BTW, i'm executing this statements directly in QA, not from within my
program. The query statement and if condition pair is plenty. i guess i
can use an else statement but it would be nested too deep. if there is
a simpler way to do it please point me to the right direction or to any
link that'll get me going.
>
Thanks in advance.
>
diego
>

|||Thank you.

Ayon kay Plamen Ratchev:

Quote:

Originally Posted by

You can use GOTO. It will look like this:
>
query statements
if condition
begin
query statements
GOTO ExitQuery
end
>
query statements
if condition
begin
query statements
GOTO ExitQuery
end
>
ExitQuery:
GO
>
Be aware that GOTO cannot go to a label outside of the batch.
>
Regards,
>
Plamen Ratchev
http://www.SQLStudio.com
>
"diego" <diegobph@.yahoo.comwrote in message
news:1168144191.844124.221930@.11g2000cwr.googlegro ups.com...

Quote:

Originally Posted by

Greetings everyone!

Is there a way to stop query analyzer from processing remaining query
statements? Let's say i have the following query in query analyzer:

query statements
if condition
begin
query statements
stop the query
end

query statements
if condition
begin
query statements
stop the query
end

is there a way to stop the query from executing the statements in the
second query when the first condition is met?

i have searched BOL and google but i couldn't find anything. I hope
anybody out there can help me.

BTW, i'm executing this statements directly in QA, not from within my
program. The query statement and if condition pair is plenty. i guess i
can use an else statement but it would be nested too deep. if there is
a simpler way to do it please point me to the right direction or to any
link that'll get me going.

Thanks in advance.

diego

|||You could also use "RETURN".

-Dave
http://www.markleconsulting.com
diego wrote:

Quote:

Originally Posted by

Thank you.
>
Ayon kay Plamen Ratchev:

Quote:

Originally Posted by

You can use GOTO. It will look like this:

query statements
if condition
begin
query statements
GOTO ExitQuery
end

query statements
if condition
begin
query statements
GOTO ExitQuery
end

ExitQuery:
GO

Be aware that GOTO cannot go to a label outside of the batch.

Regards,

Plamen Ratchev
http://www.SQLStudio.com
"diego" <diegobph@.yahoo.comwrote in message
news:1168144191.844124.221930@.11g2000cwr.googlegro ups.com...

Quote:

Originally Posted by

Greetings everyone!
>
Is there a way to stop query analyzer from processing remaining query
statements? Let's say i have the following query in query analyzer:
>
query statements
if condition
begin
query statements
stop the query
end
>
query statements
if condition
begin
query statements
stop the query
end
>
is there a way to stop the query from executing the statements in the
second query when the first condition is met?
>
i have searched BOL and google but i couldn't find anything. I hope
anybody out there can help me.
>
BTW, i'm executing this statements directly in QA, not from within my
program. The query statement and if condition pair is plenty. i guess i
can use an else statement but it would be nested too deep. if there is
a simpler way to do it please point me to the right direction or to any
link that'll get me going.
>
Thanks in advance.
>
diego
>

How to step trough procedure in Debugger

I want to debug a procedure in Query analyzer. When I open the T-SQL debugger and add all the passing parameters the debugger runs very fast and the message shows "@.RETURN_VALUE = 0".

How can I toggle breakpoints and step trough each line of the scripts. The STEP INTO, STEP OVER, RUN TO THE CURSOR all are disabled. The Name and the values are not displayed.

Please help.

ThanksQ1 How can I toggle breakpoints and step trough each line of the scripts. The STEP INTO, STEP OVER, RUN TO THE CURSOR all are disabled. The Name and the values are not displayed.

A1 First, make sure debugger support was installed on your development Sql Server. (What you are describing may be a dev workstation with VB / VStudio installed running against a dev server that does not have debugging support installed?)

Note: It is advisable NOT to run the dubugger against a production server. The debugger can be very resource intensive (especially with regard to locked resources) and the debugger is NOT bug free.

A link to more information:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310650|||SQL Server service must be logged on as non-System account:
Configure DCOM:
run dcomcnfg.exe
check DCOM settings (App.name is sqldbgreg)

For more see BOL "Troubleshooting the Transact-SQL Debugger" topic

How To Start using Query Analyzer

I'm new to sql what do you type in at the top of the Query Analyzer then you
start on the Query
Hi,
1. Choose query analyzer from SQL Server Program groups
2. In the security option, choose either Windows or SQL Authentication.
3. If it is SQL authentication give user name and password and click OK. For
Windows authentication, just click OK.
4. Once you login you could give all your TSQL commands inside that.
6. For Eg: Select * from sysobjects
7. For Execution just press F5 button in keyboard
For TSQL command usage have a look into SQL Server Books online
Thanks
Hari
SQL Server MVP
"TYE" <TYE@.discussions.microsoft.com> wrote in message
news:CCD0D16A-33DA-4802-B506-63CDB4EACA28@.microsoft.com...
>
> I'm new to sql what do you type in at the top of the Query Analyzer then
> you
> start on the Query

How To Start using Query Analyzer

I'm new to sql what do you type in at the top of the Query Analyzer then you
start on the QueryHi,
1. Choose query analyzer from SQL Server Program groups
2. In the security option, choose either Windows or SQL Authentication.
3. If it is SQL authentication give user name and password and click OK. For
Windows authentication, just click OK.
4. Once you login you could give all your TSQL commands inside that.
6. For Eg: Select * from sysobjects
7. For Execution just press F5 button in keyboard
For TSQL command usage have a look into SQL Server Books online
Thanks
Hari
SQL Server MVP
"TYE" <TYE@.discussions.microsoft.com> wrote in message
news:CCD0D16A-33DA-4802-B506-63CDB4EACA28@.microsoft.com...
>
> I'm new to sql what do you type in at the top of the Query Analyzer then
> you
> start on the Query