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

Friday, March 30, 2012

How do I adjust the tab settings in SQL Server Enterprise Manager.

I found how to adjust the tab settings when editing a stored procedure using
Query Analyzer, but I don't see any way to adjust the tab settings when
editing a stored procedure using SQL Server Enterprise Manager.
Does anyone know how to do this?
Thanks,
VernThere isn't. That dialog is only really appropriate for viewing the code or
copying it. You should use Query Analyzer to edit and will find the task is
much easier and cleaner.
Andrew J. Kelly SQL MVP
"Vern" <Vern@.discussions.microsoft.com> wrote in message
news:DF5D3DF0-B5EE-49C9-9816-F124D350F4F8@.microsoft.com...
>I found how to adjust the tab settings when editing a stored procedure
>using
> Query Analyzer, but I don't see any way to adjust the tab settings when
> editing a stored procedure using SQL Server Enterprise Manager.
> Does anyone know how to do this?
> Thanks,
> Vernsql

Wednesday, March 7, 2012

How can I write results of a query to output file and save it to the disk

Hi All,
Is there a way to write the results of a query to a file and save it to the
disk? I know that the SQL Query Analyzer gives us the option of 'results to
file'. I want to know whether I can write a script which can query the
database and redirect the results to a file, so that I can open the script
file thru SQL Query Analyzer and run it or even I can use this script in Job
Scheduling when I want.
Thanks,
NN> Is there a way to write the results of a query to a file and save it to
the
> disk? I know that the SQL Query Analyzer gives us the option of 'results
to
> file'. I want to know whether I can write a script which can query the
> database and redirect the results to a file, so that I can open the script
> file thru SQL Query Analyzer and run it or even I can use this script in
Job
> Scheduling when I want.
Just create a regular script, only T-SQL commands; you can run this commands
in QA, job task, or with OSQL.EXE command prompt utility. OSQL can save the
results to an output file. Check the parameters (specifically -i and -o) for
osql in Books onLine.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com|||Q: How can I read/write to a flat file from inside a SQL Server TSQL
script/stored-procedure/trigger?
A: http://www.mssqlserver.com/faq/general-flatfile.asp
HTH, Jens Smeyer.
http://www.sqlserver2005.de
--
"Nagaraju Nookala" <iranichai@.netscape.net> schrieb im Newsbeitrag
news:OU6DYFFRFHA.3296@.TK2MSFTNGP15.phx.gbl...
> Hi All,
> Is there a way to write the results of a query to a file and save it to
> the disk? I know that the SQL Query Analyzer gives us the option of
> 'results to file'. I want to know whether I can write a script which can
> query the database and redirect the results to a file, so that I can open
> the script file thru SQL Query Analyzer and run it or even I can use this
> script in Job Scheduling when I want.
> Thanks,
> NN
>

Friday, February 24, 2012

How can I use MDX functions in SQL Query Analyzer (Client Tool)

I'm very new to using MS-SQL stuffs and the IT dept here doesn't have any
DBMA to speak of. Thus, I'm a bit on my own - except for you helpful
people...
I just installed the Client Tools on my workstation and tried a simple query:
SELECT IIf(TBL.fld is NULL, "-N/A-", TBL.fld) FROM TBL;
and get the following error message:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'is'.
According to the help files, this should work, but clearly not. Is there
something(s) I need to enable, install, configure, tweek, activate, cajole,
or otherwise beg into acquiesence?
See reply in microsoft.public.sqlserver.setup
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"slintz" <slintz@.discussions.microsoft.com> wrote in message
news:A2D102C1-1023-413A-94D3-B82440DB08EC@.microsoft.com...
> I'm very new to using MS-SQL stuffs and the IT dept here doesn't have any
> DBMA to speak of. Thus, I'm a bit on my own - except for you helpful
> people...
> I just installed the Client Tools on my workstation and tried a simple
> query:
> SELECT IIf(TBL.fld is NULL, "-N/A-", TBL.fld) FROM TBL;
> and get the following error message:
> Server: Msg 156, Level 15, State 1, Line 1
> Incorrect syntax near the keyword 'is'.
>
> According to the help files, this should work, but clearly not. Is there
> something(s) I need to enable, install, configure, tweek, activate,
> cajole,
> or otherwise beg into acquiesence?
>

Sunday, February 19, 2012

How can I test for divide by zero without using CASE?

Since the query builder (not the query analyzer) in enterprise manager does
not support case statments, I was wondering if there's a way to structure
the following in a different way (without case statements) so that the query
builder works. I thought there might be a way to do soemthing with NULLIF
and/or COALESCE but I got stuck.
CASE WHEN x = 0 THEN 0 ELSE y/x END AS AvgCustBalance
Thanks,
Keith> Since the query builder (not the query analyzer) in enterprise manager
> does
> not support case statments, I was wondering if there's a way to structure
> the following in a different way (without case statements) so that the
> query
> builder works.
Sure, don't use the query builder. Why do you want to force yourself to use
a tricycle to commute to work, when there's a Ferrari in your driveway?|||> Since the query builder (not the query analyzer) in enterprise manager
> does
> not support case statments, I was wondering if there's a way to structure
> the following in a different way (without case statements) so that the
> query
> builder works. I thought there might be a way to do soemthing with NULLIF
> and/or COALESCE but I got stuck.
> CASE WHEN x = 0 THEN 0 ELSE y/x END AS AvgCustBalance
How about :
WHERE x <> 0
--
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane|||Well, that will leave rows out. I wonder if something like this will work:
SELECT COALESCE(y/NULLIF(x,0),0)
FROM
(SELECT x = 1,y=5
UNION ALL SELECT x=2,y=5
UNION ALL SELECT x=0,y=5) z
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:uDUnLsoyFHA.904@.tk2msftngp13.phx.gbl...
> How about :
> WHERE x <> 0
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "When you kill a man, you're a murderer.
> Kill many, and you're a conqueror.
> Kill them all and you're a god." -- Dave Mustane
>|||Could you tell me what tool you are referring to as a Ferrari?
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:ue40XqoyFHA.3700@.TK2MSFTNGP10.phx.gbl...
> Since the query builder (not the query analyzer) in enterprise manager
> does
> not support case statments, I was wondering if there's a way to structure
> the following in a different way (without case statements) so that the
> query
> builder works.
Sure, don't use the query builder. Why do you want to force yourself to use
a tricycle to commute to work, when there's a Ferrari in your driveway?|||If one is a todler, then it makes perfect sense. ;-)
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:ue40XqoyFHA.3700@.TK2MSFTNGP10.phx.gbl...
> Sure, don't use the query builder. Why do you want to force yourself to
> use a tricycle to commute to work, when there's a Ferrari in your
> driveway?
>|||Query Analyzer, or a host of third party tools. Enterprise Manager is
definitely not the place to write code, view data or manage objects.
"Keith G Hicks" <krh@.comcast.net> wrote in message
news:e3R06DpyFHA.2960@.tk2msftngp13.phx.gbl...
> Could you tell me what tool you are referring to as a Ferrari?
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message
> news:ue40XqoyFHA.3700@.TK2MSFTNGP10.phx.gbl...
> Sure, don't use the query builder. Why do you want to force yourself to
> use
> a tricycle to commute to work, when there's a Ferrari in your driveway?
>
>|||Keith,
Try (as test):
--test for /0 error without using case
CREATE TABLE YX
(Y INT NOT NULL,
X INT NOT NULL)
INSERT YX
VALUES(10,1)
INSERT YX
VALUES(10,0)
INSERT YX
VALUES(10,2)
SELECT Y,X,COALESCE(Y/NULLIF(X,0),0) AS 'Y/X'
FROM YX
HTH
Jerry
"Keith G Hicks" <krh@.comcast.net> wrote in message
news:exTFjnoyFHA.1028@.TK2MSFTNGP12.phx.gbl...
> Since the query builder (not the query analyzer) in enterprise manager
> does
> not support case statments, I was wondering if there's a way to structure
> the following in a different way (without case statements) so that the
> query
> builder works. I thought there might be a way to do soemthing with NULLIF
> and/or COALESCE but I got stuck.
> CASE WHEN x = 0 THEN 0 ELSE y/x END AS AvgCustBalance
> Thanks,
> Keith
>|||This is good, thanks. I didn't realize that 5/null = null. Guess that should
have been obvious.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uREka%23oyFHA.3812@.TK2MSFTNGP09.phx.gbl...
SELECT COALESCE(y/NULLIF(x,0),0)
FROM
(SELECT x = 1,y=5
UNION ALL SELECT x=2,y=5
UNION ALL SELECT x=0,y=5) z|||As far as I understand QA does not have a feature that lets you build
queries in a visual way like you can in EM. I'm a very visually oriented
person and prefer to work in that type of an environment when I can. I
generally use Database workbench for most of my SQL work and I'm very happy
with that. But the vsiual query builder is far from complete. If you don't
mind listing some of the "host of third party tools" I'd find that a bit
more helpful.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OsN1zGpyFHA.2076@.TK2MSFTNGP14.phx.gbl...
Query Analyzer, or a host of third party tools. Enterprise Manager is
definitely not the place to write code, view data or manage objects.
"Keith G Hicks" <krh@.comcast.net> wrote in message
news:e3R06DpyFHA.2960@.tk2msftngp13.phx.gbl...
> Could you tell me what tool you are referring to as a Ferrari?
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message
> news:ue40XqoyFHA.3700@.TK2MSFTNGP10.phx.gbl...
> Sure, don't use the query builder. Why do you want to force yourself to
> use
> a tricycle to commute to work, when there's a Ferrari in your driveway?
>
>