Problem With Sp Running As Job Versus In Query Analyzer

Jul 8, 2002

Hello,

Specifically, I'm having an issue that I can't resolve using the database space utilization procedures recently submitted by Paul Matthews. The servers are appropriately linked and the procedures have been created on the required servers (mix of 7.0 and 2000 systems).

Executing the sp_dbspaceall procedure from query analyzer is successful but it fails when called from a SQL Agent job. It only returns the information of the local server in that instance.

The error message tells nothing of the problem and the logs show nothing at all about the incident. Can someone help me out?

View 3 Replies


ADVERTISEMENT

Running A DLL In The Query Analyzer

Nov 23, 2007

Hi,I have a DLL that I want to run from the Query Analyzer. I tried thefollowing:USE master;EXEC sp_addextendedproc BLAH, '\Other-ServerPathToBlahBlah.dll'and I get the error:ODBC: Msg 0, Level 16, State 1Cannot load the DLL \Other-ServerPathToBlahBlah.dll, or one ofthe DLLs it references. Reason: 126(The specified module could not befound.).The DLL was written in Cobol. The "Other-Server" in the Path above isthe server that Cobol (and the DLL) is located on.I looked at the dependencies for the DLL and it includes (notsurprisingly) Cobol Dll's. It should find those on the other server.What can I do?Thanks!

View 5 Replies View Related

Re-display Result Set Without Re-running Query In Query Analyzer?

Apr 9, 2006

I hope I am not asking about something that has been done before, but Ihave searched and cannot find an answer. What I am trying to do is torun a query, and then perform some logic on the rowcount and thenpossibly display the result of the query. I know it can be done withADO, but I need to do it in Query Analyzer. The query looks like this:select Varfrom DBwhere SomeCriteriaif @@Rowcount = 0select 'n/a'else if @@Rowcount = 1select -- this is the part where I need to redisplay the resultfrom the above queryelse if @@Rowcount > 1-- do something elseThe reason that I want to do it without re-running the query is that Iwant to minimize impact on the DB, and the reason that I can't useanother program is that I do not have a develpment environment where Ineed to run the queries. I would select the data into a temp table, butagain, I am concerned about impacting the DB. Any suggestions would begreatly appreciated. I am really hoping there is something as simple as@@resultset, or something to that effect.

View 6 Replies View Related

Error In Running DTS Package From Query Analyzer

Apr 27, 2001

I am trying to run DTS package from query analyzer and getting following error .

Command from query analyzer is

go
master..xp_cmdshell 'dtsrun /Sirhahadb01 /Usa /P<sa password> /Ntestpack'

Output error message is

output
DTSRun: Loading...

DTSRun: Executing...

DTSRun OnStart: DTSStep_DTSDataPumpTask_1

DTSRun OnError: DTSStep_DTSDataPumpTask_1, Error = -2147217887 (80040E21)

Error string: Errors occurred

Error source: Microsoft OLE DB Provider for SQL Server

Help file:

Help context: 0



Error Detail Records:



Error: -2147217887 (80040E21); Provider Error: 0 (0)

Error string: Errors occurred

Error source: Microsoft OLE DB Provider for SQL Server

Help file:

Help context: 0



DTSRun OnFinish: DTSStep_DTSDataPumpTask_1

DTSRun: Package execution complete.



Sujit

View 2 Replies View Related

SQL 2000 Running Scripts In Query Analyzer

Mar 25, 2008

Does anyone know how to run a script to get the log size and log space?

When I run the following command it does not work and I don't know why.

DBCC SQLPERF (logspace)

USE [master]
GO
SELECT *
FROM sysfiles
WHERE name LIKE '%LOG%'
GO

EXEC sp_spaceused

If I run this command on a different server I get the ouput that I need. Any help would be greatly appreciated.

msr976

View 4 Replies View Related

Report Running Very Slow Compared To Query Analyzer - High TimeDataRetrieval

Jun 26, 2007

Hi,



I have a report in SQL Reporting Services 2005 which calls a stored proc and the report takes a very long time to run and sometimes returns zero records. But when i run the stored proc in query analyzer it takes about 4 seconds!!



I have checked the execution log on the RS using the below sql:






Code Snippet

use ReportServer

Select * from ExecutionLog with (nolock) order by TimeStart DESC



It shows that i have a large amount of time for the dataretrieval (601309ms, about 10mins) and does not return any records most likely because of a query timeout:



TimeDataRetrieval TimeProcessing TimeRendering Source Status ByteCount RowCount
601309 2227 3 1 rsSuccess 4916 0



The weird thing is that when i run it in query analyzer, i get about 400 records in 4 seconds !!



I dont understand what RS is doing to take up so much time like this to retrieve data.



The report is very simple - it basically returns the records straight out into a table.



The only thing I somewhat suspected was a parameter data type conflict between RS and SQL, specifically dates. I have a start and end date parameter in the report - i tried specifying this as date and string to see if it made any difference but it didn't.



Any help would be greatly appreciated.

View 19 Replies View Related

Running DTS From Querry Analyzer

Sep 21, 2007

Hi,How to run a DTS from query analyzer using some t-sql commands??? Is it possible?? What is the command to run a DTS from QA???and What are the possible ways of running a DTS?? from how many types we can execute a DTS like 2 of it i know from EM directly and from the help of Schedule jobs.

View 1 Replies View Related

Query Performance With DateTime Versus Int Condition

Jul 10, 2007

Good day,



The following query performs acceptably (2 seconds against 126,000,000 rows in the main table):

SELECT Count(*)

FROM

Message1_2_3 INNER JOIN

VDMVDO ON Message1_2_3.VDMVDO_ID = VDMVDO.VDMVDO_ID INNER JOIN

NMEA ON VDMVDO.NMEA_ID = NMEA.NMEA_ID

WHERE

NMEA.NMEA_ID BETWEEN 14000000 AND 14086000 AND

VDMVDO.RepeatIndicator = 0 AND

NMEA.SentenceFormatterID = 'VDM'



When we change the first condition from an Int column to a DateTime as in:

NMEA.TimeDate BETWEEN CONVERT(DATETIME, '2007-07-09 8:30:00', 102) AND CONVERT(DATETIME, '2007-07-09 9:30:00', 102)



the query performance falls to 14 seconds, even though both columns are indexed and a similar number of rows are found. When the select clause changes from a simple Count to a complex Max expression, response time falls to over a minute!



Any thoughs on optimizing the DateTime search would be greatly appreciated...

View 4 Replies View Related

Sql Query Speed 2000 Versus 2005

Aug 15, 2007

We have an interesting problem. We are attempting to migrate from sql 2000 to sql 2005. the schema we have is exactly the same. the new 2005 box is more powerful than our 2000 box.

here is our schema:

tbl_Items
ItemID int pk
ReferenceID int
sessionid varchar(255)
StatusID int

tbl_ItemsStatus
statusid int pk
isinternalstatus bit

there is an index on (ReferenceID, SessionID, StatusID) and (SessionID, StatusID)

this is the query:

DECLARE @referenceid INTEGER
SET @referenceid = 1019

SELECT MAX(i2.itemid)
FROM tbl_Items i2 (NOLOCK)
JOIN tbl_ItemsStatus s (NOLOCK)
ON i2.StatusID = s.StatusID
WHERE
s.IsInternalStatus = 0
AND i2.referenceid = @referenceid
AND i2.sessionid IN (
SELECT i3.sessionid
FROM tbl_Items i3 (NOLOCK)
WHERE
i3.referenceid = @referenceid
AND i3.status <> 7
AND i3.status <> 8
AND i3.status <> 10
AND i3.itemid IN (
SELECT max(i4.itemid)
FROM tbl_Items i4 (NOLOCK)
WHERE i4.referenceid = @referenceid
GROUP BY i4.sessionid
)
AND i3.itemid NOT IN (
SELECT MAX(i7.itemid )
FROM tbl_Items i7 (NOLOCK)
WHERE
i7.referenceid = @referenceid
AND i7.SessionID IN (
SELECT i5.SessionID
FROM tbl_Items i5 (NOLOCK)
WHERE
i5.status <> 11
AND i5.referenceid = @referenceid
AND i5.itemid IN (
SELECT MAX(i6.itemid)
FROM tbl_Items i6 (NOLOCK)
WHERE
i6.referenceid = @referenceid
AND i6.status IN (7,11,8)
GROUP BY i6.sessionid
)
)
GROUP BY i7.SessionID
)
)

GROUP BY i2.sessionid

we know this query is pretty bad and can be optimized. however, if we run this query as is on 2005 it takes about 2 hours to run...if we run the exact same query on 2000 it takes 9 seconds.

so this query on 2005 if run takes 2 hours..however, if we omit the s.IsInternalStatus = 0 or the i2.referenceid = @referenceid line it takes about 9 seconds.

why would this be? it makes no sense why omitting one of those where clauses would increase the performance of the query by 2 hours? we know its a bad query...but this doesnt make sense.

any one else run into this problem?

View 1 Replies View Related

Easy SQL Question. How To Display Query Results In Query Analyzer

Feb 12, 2008

When I run the following query from Query Analyzer in SQL Serer 2005, I get a message back that says.
Command(s) completed successfully.
What I really need it to do is to display the results of the query. Does anyone know how to do this?
declare     @SniierId as   uniqueidentifierset @SniierId = '85555560-AD5D-430C-9B97-FB0AC3C7DA1F'declare    @SniierAlias  as nvarchar(50)declare    @AlwaysShowEditButton  as bitdeclare     @SniierName  as  nvarchar (128)/* Check access for Sniier */SELECT TOP 1       @SniierName      = Sniiers.SniierName,        @SniierAlias    = Sniiers.SniierAlias,        @AlwaysShowEditButton = Sniiers.AlwaysShowEditButtonFROM SniiersWHERE Sniiers.SniierId=@SniierId

View 3 Replies View Related

Query Performance Hard Coded Value Versus Table Driven

Nov 6, 2014

I want to be able to return the rows from a table that have been updated since a specific time. My query returns results in less than 1 minute if I hard code the reference timestamp, but it keeps spinning if I load the reference timestamp in a table. See examples below (the "Reference" table has only one row with a value 2014-09-30 00:00:00.000)

select * from A where ReceiptTS > '2014-09-30 00:00:00.000'

select * from A where ReceiptTS > (select ReferenceTS from Reference)

View 5 Replies View Related

Query Analyzer Runs The Query Instantly But ADO Can Take Forever???

Aug 29, 2001

THis is so annoying. I have 3 ADO executes in my program. THe first one creates a view, the second one performs an outer join on that view and returns a result set, the third execute drops the aforementioned view. THe program that is using this is installed on about 200 computers scattered across Germany and Italy, all querying the same MSsql server 7.0. THe queries run quite quick when few users are actively using the program (after hours for example). however in the heat of the day performance goes up and down dramatically with identical queries taking from 1 to 20 seconds to return their result set. Now I initially thought 'bandwidth issue out of our server'. However I noticed that if I take those three queries and run them from the sql server enterprise manager( running on the same computer as the aforementioned program) then the queries run instantly and the data is in my result pane in less than 2 seconds ALWAYS....even when the program is dogging it with 20 second delays before the result set returns. I know it is hanging on the return of the result set as I put a stop after before each ADO execute in order to check which one was eating up my time. Why is there this dichotomy between running the queries from my enterprise manager versus running them from an ADO object. Both are using TCP/IP (no named pipes involved). I havent monkied with the attributes of the ADO result set so they are all set to default.
I have used the sql server profiler to trace these queries and they always run in less than 33 milliseconds. THe duration is also never more than 33 milliseconds. THis stinks of a network resource issue but what always leads me somewhere else is how consistent the performance of the enterprise manager is when it runs the exact same three queries.

Here is my slightly edited connection string
Public Const connection_string = "Provider=SQLOLEDB;Server=000.000.000.000;" & _
"User ID=johndoe;Password=janedoe;Network=dbmssocn;" & _
"database=fidojoe"

Here are the 3 ADO executes:
conn.Execute (sqlstr_create_view)
Set resultset1 = conn.Execute(sqlstr_get_providers_by_DMISID)
conn.Execute (sqlstr_drop_view)

View 3 Replies View Related

Same Query Gives Result With Different Column Sequence When Used In Query Analyzer

Feb 25, 2012

When I run query in excel it gives result with different column sequence. The same query gives result with different column sequence when used in query analyzer or VBA Macro. E.g., Select * from ABC.

result in Excel 2003 SQL OLE DB query

col-A col-B col-C
values...

Result with Query Analyzer and VBA Macro

col-c col-B col-A
values...

View 3 Replies View Related

How To Kill A Long Running Query Running On A Background Thread.

Sep 1, 2006


If I start a long running query running on a background thread is there a way to abort the query so that it does not continue running on SQL server?

The query would be running on SQL Server 2005 from a Windows form application using the Background worker component. So the query would have been started from the background workers DoWork event using ado.net. If the user clicks an abort button in the UI I would want the query to die so that it does not continue to use sql server resources.

Is there a way to do this?

Thanks


View 1 Replies View Related

Determine Fastest Query In Query Analyzer

Sep 17, 2005

I am trying to determine which of three stored procedure designs arefastest in the Query Analyzer:One query is a straight SELECT query with all desired rows and a dozen(tblName.RowName = @param or @param = Null) filters in the WHEREstatement.One query populates a #Temp table with the UniqueIDs from the resultsof the SELECT query in the above example, then joins that #Temp tableto get the desired rows.One query users EXEC sp_executesql @sql, @paramlist, @paramin which the @param has the dozen filters.What I'm trying to determine is which is the fastest.Each time I run the query in Query Analyzer it returns the samerecordset (duh!) but with much different Time Statistics.Are the Time Statisticts THE HOLY QRAIL as far as determining which isfastest, and what so I want to look at, the Vale or the Average? Inotice there are different numbers of bytse sen and bytes received foreach of the three queries.Any illumination on this is appreciated.lq

View 4 Replies View Related

Query Analyzer, Slow Query Responses

Sep 25, 2006

Hi there

Running query analyzer against two different server.

the first only need 1-2 secs to return the query result,

the other return 7-8 secs for the query result.

plz advice what could cause this slow performance?



thx



View 1 Replies View Related

Where Is Query Analyzer?

Aug 2, 2006

Is Query Analyzer being droped in MS-SQL 2005? I'm using Microsoft SQL
Server Managemant Studio and I couldn't find the Store Procedure node
and Query Analyzer anymore. Help is appreciated.

View 2 Replies View Related

SQL Query Analyzer

Aug 16, 2007

Say you have a state column with the name of a state in it. And you need to add a branchId to the table. I know I should not have it in there, and the application should use proper lookup tables, but that's not the case.
 Can SQL Server query analyzer loop through and update the branchid field based on a lookup in a lookup table?
 How would that be done?

View 3 Replies View Related

Query Analyzer

Apr 4, 2008

Hi All,
 I think I post this in a wrong section but I cant find forum for sql server and i just have a quick question
basically, I installed sql server 2005 and I need to debug a store procedure.1. Does query analyzer come with sql server 2005?2. If not how can I debug store procedure in sql server 2005?Thanks in advance

View 2 Replies View Related

Query Analyzer

Mar 22, 2001

Does anyone know if there is a limitation in Query Analyzer in terms of the number of characters in a query that it will parse?

I am having a problem with some large queries, and I am not sure if it is Query Analyzer, or the SQL Server query parsing engine that is causing the problem.

The query just involves a simple SELECT statement, albeit for a large number of columns.

View 2 Replies View Related

Query Analyzer...

Aug 2, 2000

Hi,

I'm using SQL Server 7.0. I connect to one database in Query Analyzer and I can use the "Perform Index Analysis" option under the "Query" menu option. when I connect to one of our other databases, the "Perform Index Analysis" option under the "Query" menu option is disabled (greyed out). Does anyone know what the problem could be and how might I be able to enable this option.

Thanks in advance,
Darrin

View 1 Replies View Related

QUERY Analyzer Help

Mar 8, 2006

Hello
In query Analyzer of SQL2000 when i select
2 Select Queries and Run it shows in same Window as 2 Grids
I have seen people using seperate grid option to view each query results in a Tab query results Pane in MSSQL 7.

Eg Select * from table1 (in one grid)
select * from table2 (in another grid)
like a TAB so that i can move from one tab to another.

Is it possible to do that in query Analyzer?
Regards

View 3 Replies View Related

Query Analyzer

Jan 5, 2004

I would like to use the Query Analyzer to create a script that will prompt the user(dialog box) for a response in SQL Server 7.0. I found a post someone mentioned DBMS can return messages and using Query Analyzer.

Thanks for your help in advance.

View 3 Replies View Related

Help With SQL Query Analyzer

Jan 17, 2006

I'm trying to do a couple of things with some different tables.

With the first table, I have first name and last name in two separate columns.

I'm trying to create a new ID column that would do the following.

Take the first 3 letters of the last name (and remove any non characters such as ',&) and the first 3 letters of the first name, and then combine them.

I know how to use substring to take the first three, and I know how to combine them, but I'm having problems removing the non alpha characters.

For example, if the columns looked as follows:
First Last
John O'Connor

I'd want the result to look like OCOJOH, however, I'm getting O'CJOH.


The second issue is how would I do something similar if the First and Last Name were in the same column and string.

For example, if the column looks as follows:

Name
John O'Connor Publishing

I'd like to pull the first 3 from the first string before the space and then the next 3 so it would be as follows:

JOHOCO


Finally, I want to compare these new IDs, and add numbers to them.

So if I had the following
First Last
John O'Connor
Johnny O'Connell

The first would be OCOJOH01
The second would be OCOJOH02

If there are not any duplicates with the new ID, I'd like to call it OCOJOH01 and then move on.

Any help/ideas would be greatly appreciated.

Thanks

View 8 Replies View Related

Query Analyzer

Mar 29, 2006

Hi;

I would like to change the format of dates that is in colum using query analyzer. The name of the colum is StartD and this how they look: 3292006 I would like to insert the / / . Can someone show me how to accomplish it.

Thank you

View 10 Replies View Related

Query Analyzer Help

Mar 19, 2007

I have a database with couple of store procedure and views.
Is there any way that i can find out all sp or views which contains word like *svc*. I am talking about the containt of the sp and views not name.

We are replacing one module so i have to change the all sp and views which use table or view start with svc.

Need help.

Thanks

View 3 Replies View Related

Is There A Query Analyzer

Feb 21, 2007

in the market place that will run a query on multiple DBs acrossmultiple servers? Without having to manually connect to each server?If so, can anyone provide a link for it.Thanks

View 3 Replies View Related

SQL Query Analyzer

Aug 15, 2006

I am new to SQL and need help running a performance check on our companies dtabase. I use SQL Enterprise Manager 2000. Could someone please help me accomplish this?

Thanks,

Carl

View 3 Replies View Related

Little Help With Query Analyzer

Nov 26, 2007



hi everybody!
this is my first post, so I'd like to say hallo to everyone!

I "work" on SQL Server 2000, and I would like to ask you a question.

Is it correct that i cannot set a database user as database owner (using command sp_changedbowner 'user_name')?
QA returns this error message:
"Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
The proposed new database owner is already a user in the database."
so I have to use sp_revokedbaccess and then I can change the db owner.

why can't a db user be the db owner?

thanks for the answers!!

View 3 Replies View Related

Query Analyzer

May 25, 2007

Hi,



Was wondering if anyone can tell me how to get the Query Analyzer Tool installed to WM6 Professional Emulator inside of VS05?



Thanks,

John.



View 3 Replies View Related

Query Analyzer

Oct 18, 2007

Hello,

how is the query analyzer opening a database??? Does someone knows the command it uses to open the connection ??

I ask this because i have corrupted datafiles stored on a flash card which i can not open with connection.open but the analyzer opens them normally. After that i can open the datafiles using normal code

Does it use any special params?? I get the corrupted files on power down and after that i can not open them from my application. I can only do this after i open them once with the query analyzer

The database is about 20 MB stored on a flash card

Thanks in advance

View 1 Replies View Related

How To Debug In Query Analyzer?

Oct 4, 2007

Say I have this query in my stored procedure. The problem I am facing is @OrgUID contains no value, so I put these 2 lines to debug. Am I using the right way to debug? I couldn't see the value of @OrgUID using this way. OrgUID is the PK in Organization. INSERT INTO Organization (OrgName) VALUES (@DealerName)SELECT @OrgUID = @@IDENTITYprint @OrgUIDreturn 

View 4 Replies View Related

Need Help Getting A Return Value In SQL Query Analyzer

Jan 17, 2008

This has got to be a simple one, but I could not find out how
I have this simple proc for test purposes only...
 
ALTER    PROCEDURE dbo.RotoTest( @strSSN VARCHAR(11), @blnUseACHDate BIT = 0,  @intInvestorId int = 0)ASreturn 5
 
Thats right it does nothing but return 5 and thats because I removed all the real code to simplify my question.
When I hit this proc in SQL Query Analyzer..
exec RotoTest '123-45-6789', 0, 1     No return value is displayed in Query Analyzer.
When I try something like this
exec RotoTest '123-45-6789', 0, 1, intRetValue Output    (in this situation I get wrong number of arguments)
How can I get a return value displayed on my screen in SQL QUERY ANALYZER with out modifying the proc?  I do not want to modify the proc in anyway (because I can't), I just want to display the return value
 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved