Query Runs Fine In Query Analyser But Not The Query Debugger

Dec 19, 2003

I'm running a query, actually its an insert that works when using the TSQL below.





However when I try to use the debugger to step through and using the exact same values as those below I get the following error:





[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification





Its Killing me because everything else works, but this. Can somebody help.








DECLARE @NoteID INT,-- NULL OUTPUT,


@Note_Description NVARCHAR(3000),-- = NULL,


@Date DateTime,-- = NULL OUTPUT,


@ByWho NVARCHAR(30),-- = NULL,


@FK_Action_Performed NVARCHAR(40),-- = NULL,


@FK_UserID INT,-- = NULL,


@FK_JobID INT,-- = NULL,


@Job_Date DateTime,-- = NULL,


@Start DateTime,-- = NULL,


@Finish DateTime,-- = NULL,





@BeenRead NVARCHAR(10),-- = NULL





@FK_UserIDList NVARCHAR(4000)-- = NULL








--SET @NoteID = 409 --NULL OUTPUT,


SET @Note_Description = 'Tetsing'


--SET @Date DateTime = NULL OUTPUT,


SET @ByWho = 'GeorgeAgaian'


SET @FK_Action_Performed = 'Worked hard'


SET @FK_UserID = 5


SET @FK_JobID = 29


SET @Job_Date = 28/01/03


SET @Start = '1:00:20 PM'


SET @Finish = '1:00:20 PM'


SET @BeenRead = 'UnRead'





SET @FK_UserIDList = '1,2,3'








--AS





--SET NOCOUNT ON








SET NOCOUNT ON





SET XACT_ABORT ON





BEGIN TRANSACTION





SET @Date = GETDATE()





-- Insert Values into the customer table


INSERT Note (Note_Description,


Date,


ByWho,


FK_Action_Performed,


FK_UserID,


FK_JobID,


Job_Date,


Start,


Finish)





SELECT --@NoteID,


@Note_Description,


@Date,


@ByWho,


@FK_Action_Performed,


@FK_UserID,


@FK_JobID,





@Job_Date,


@Start,


@Finish





-- Get the new Customer Identifier, return as OUTPUT param


SELECT @NoteID = @@IDENTITY








-- Insert new notes for all the users that the note pertains to, in this case this will be by the assigned


-- users.


IF @FK_UserIDList IS NOT NULL


EXECUTE spInsertNotesByAssignedUsers @NoteID, @FK_UserIDList





-- Insert New Address record


-- Retrieve Address reference into @AddressId


-- EXEC spInsertForUserNote


-- @FK_UserID,


--@NoteID,


-- @BeenRead


-- @Fax,


-- @PKId,


-- @AddressId OUTPUT





COMMIT TRANSACTION





--------------------------------------------------


GO

View 1 Replies


ADVERTISEMENT

SQL Server 2008 :: Query Runs Fine Individually But Not Together?

Jul 21, 2015

I am able to select the average, max, etc of the variable in a simple select statement but when I do the following, it doesn't work. The reason I am doing the following is because I am calculating the average and such over a 5 min interval, then saving the output as one line. That is why I condense average, max, min, and stdev into one variable which I then output. why it won't run when I have it like this but will run when it is like this?

will run:

SELECT AVG(NacTemp), MAX(NacTemp),MIN(NacTemp), STDEV(NacTemp)
FROM [DATABASE]
WHERE [UTCDeviceTimeStamp] between DATEADD(minute, -5, GETUTCDATE()) and GETUTCDATE()

won't run but I need it to:

DECLARE @now datetime SET @now = GETUTCDATE() --Universal Time
DECLARE @timeint int SET @timeint = '5' --time interval in minutes
DECLARE @time datetimeSET @time = (SELECT MIN([UTCDeviceTimeStamp]) FROM [DATABASE] WHERE [UTCDeviceTimeStamp] BETWEEN DATEADD(minute, -@timeint,@now) AND @now) -- Timestamp data will be saved as
DECLARE @comma varchar(4) SET @comma = ', '

[Code] ....

View 9 Replies View Related

Dataset Query Runs Fine In VS, But Not On The Reports Server

Mar 28, 2008

I have created a lot of reports using this technique, but this is the first one that doesn't work. As there is absolutely nothing special about it, I can't figure out what the issue is.

I have one dataset that uses parameters chosen from two other dataset results. One dataset result runs just fine and returns values in reporting services, but the other returns blank in reporting services. In Visual Studio, both datasets return data.

I cannot for the life of me figure out what I've done that gives this result as I've never encountered it before and use this method of parametization quite frequently.

The dataset in question doesn't even join any tables, it's a direct select distinct field"1" from table"a".

I'm running SQL2005, SP2.

Thanks for any advice.

Margaret

View 6 Replies View Related

Why The Query Works In Query Analyser And Doesn't Work In Reporting Service ?

Apr 30, 2007



Hello everybody,



I'm developing a report using the following structure :



declare @sql as nvarchar(4000)

declare @where as nvarchar(2000)



set @sql = 'select ....'



If <conditional1>

begin

set @where = 'some where'

end



If <conditional2>

begin

set @where = 'some where'

end



set @sql = @sql + @where



exec(@sql)



I run it in query analyser and works fine, but when I try to run in Reporting Services, Visual studio stops responding and the cpu reaches 100 %.



I realize that when I cut off the if clauses, then it works at Reporting services.

Does anybody know what is happening?

Why the query works in query analyser and doesn't work in Reporting Service ?



Thanks,



Maurício

View 2 Replies View Related

How To Query An Oracle Data From SQL Server Query Analyser

Sep 3, 2007



Hi ,

I am having 2 data store .
1. Oracle 10g
2 SQL server 2000

My requirement is that , i need to insert some data from sql server database table to oracle database using sql server query analyser or interface.


If there is any way ,plz let me know it


Thanks
Abraham

View 3 Replies View Related

A Query Runs Fast In Query Analuser But Slow In APplication

Jul 23, 2005

I am able to run a query which runs FAst in QA but slow in theapplication.It takes about 16 m in QA but 1000 ms on theApplication.What I wanted to know is why would the query take a longtime in the application when it runs fast on SQL server?How should we try debugging it?Ajay

View 2 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

Query Call By App Runs Long, Same Query In QA Doesn't.

Feb 19, 2008

Hi Guys,

I've got a stored proc used for order generation which runs long sometimes when called from within our app. A normal run will complete within 20s, a long run will get terminated by the app at the 6 minute mark.

When it runs long once, repeated attempts will also do so until I execute the same query the app did, but from within Query Analyzer. At which time the problem will disappear for a day or two. The app connects to the SQL Server 200 SP4 database using ADO.

I suspected statistics might be at fault here but have tried both "UPDATE STATISTICS table WITH FULLSCAN" and "DBCC DBREINDEX('table') to no avail. This issue has occurred and been worked around in this manner a few dozen times.

Any idea what might be going on here?

View 7 Replies View Related

A Procedure Runs Slow As A Job But Runs Fast Executed In A Query Window

Apr 23, 2008

Performance issue.


I have a very complex Stored Procedure called by a Job that is Scheduled to run every night.
It's execution takes sometimes 1 or 2 hours and sometimes 7 hours or more.

So, if it is running for more than 4 hours I stop the Job and I run the procedure from a Query Window and it never takes more than 2 hours.

Can anyone help me identify the problem ? I want to run from the Job and not to worry about it.

Some more information:
- It is SQL 2000 Enterprise with SP4 in a Cluster (It happens the same way in any node).
- The SQL Server and SQL Agent services run using a Domain Account that have full Administrative access.
- When I connect to a Query Window I also use a Windows Account.

- There is no locks or process bloking or being blocked while the job is running.
- Using the Task Manager the processor activity is ok, no more than 30 % in any processor.

View 15 Replies View Related

Is A Bug In Query Analyser

Sep 29, 2000

Hi

This what i did , since i need to maintain
five sql servers ,i thought i will build a repository
so on my desk top (running sql server ) i created a
table name master_dbscript with the following fields

server_name varchar(20),
dbname varchar(20)
db_create_scripts text

using enterprise manager-- all tasks --generate sql scripts , (cut & paste
to the insert statement in query analyser, the following is the insert statement

insert into master_dbscript values ('isd11t','test','ALTER TABLE [dbo].[child] DROP CONSTRAINT FK_child_parent GO /****** Object: Trigger dbo.test_patcase Script Date: 25/08/2000 12:10:09 ******/ if exists (select * from sysobjects where id = object_id(N'[dbo].[test_patcase]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)drop trigger [dbo].[test_patcase] GO ')

oops it created all the objects in the database where i tried to run the
insert statement. god saved me , i tried this with the test database.

when i tried the same with bcp it worked fine and i was able to see the
record in my table (one record) ,note you cannot use dts because it will support maximum 8000 chars only .

what is the problem with the query analyser ?

View 1 Replies View Related

Help On Query Analyser

Aug 2, 2003

Hi Everybody,

I am executing the following query in the query analyser.

"select * from alien119700 order by alienid"

In the message pane it shows

SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 4 ms.
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 0 ms.

(43 row(s) affected)


SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 454 ms.
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 0 ms.


What does all this mesaages mean?

Can anyone explain this to me?

Thanx in advance.

Regards,

Samir.

View 1 Replies View Related

SQL Query Analyser

Jun 6, 2002

We use SQL 2K(service pack 1).Our query analyser will freeze often.So we loose all query production work.Does anyone know if Version 2 has a fix?Please help.

View 4 Replies View Related

Using Query Analyser

Jan 5, 2006

I noticed that query analyser is much more quicker than EManager when I access my database from my hosting provider... is there any way to see the properties of the table X for example as one can do with EM...

I would be grateful if you could provide me with any query sample conserning this issue...

Thanks

View 9 Replies View Related

Query Analyser

Mar 20, 2006

Jst curios,

How does the Query Analyser connect to the database..does it use any of the ODBC or OLE DB API's

THx
Venu

View 1 Replies View Related

Query Analyser

May 24, 2007

I am currently using the trial version of SQL 2000 to connect to a remote db so I can query the data.

When the trial version runs out what can i do? will MSDE work for me or will the express edition of SQL 2005 be better?

Thanks! Bruno

View 1 Replies View Related

Query Analyser

Feb 1, 2008

Is there Query Analyser in SQLServer 2005 like there was in 2000 ? If so, how do I access it.

Thanks

View 9 Replies View Related

Query Analyser

Jun 18, 2006

Hi,

Can't seem to find which download includes Query Analyser, I have downloaded Management Studio Express

Help Please

View 3 Replies View Related

Query Analyser Is Not Working

Jun 11, 2001

Hi All ,

In my M/c the query analyser is not working when ever I try to run it by Using Enterprise manager / Explorer / Start menu - Program / Isqlw.exe.

When I Tried the task manager it shows the process isqlw is working. But I can't see any window coming up ..

Please help me otherwise I will go mad....using other tools to query . 50 % time i use this tool in work. U guys know how important it is ..
Thank u

Jeo

View 2 Replies View Related

Query Analyser Is Not Working

Jun 11, 2001

Hi All ,

In my M/c the query analyser (SQL 2000) is not working when ever I try to run it by Using Enterprise manager / Explorer / Start menu - Program / Isqlw.exe.

When I Tried the task manager it shows the process isqlw is working. But I can't see any window coming up ..

Please help me otherwise I will go mad....using other tools to query . 50 % time i use this tool in work. U guys know how important it is ..
Thank u

Jeo

View 1 Replies View Related

Query Analyser Without SQL Server Name

Jun 3, 2004

Hi,

I am studying SQL Server by myself (I am a Sybase DBA) and I have a little problem with the Query Analyser.

I actually have 2 server in my PC (XP) and I can see them via SQL Server Enterprise Manager, I also can open Query Analyser for these two server via Enterprise Manager.

When I try to launch SQL Query Analyser from the start menu, I can't see any of my two server and can't chose a connection.

Do I need to write some parameter somewhere?

It's not a big problem as I can work via Enterprise Manager but I just want to know.

Thank you for your response.

Eric

View 6 Replies View Related

Sessionid In Query Analyser

Sep 30, 2005

I want to know my session id number in Query Analyser

Do you know a procédure or a command ?

View 3 Replies View Related

Query Analyser In 2005 ?

Feb 14, 2006

I cannot find the query analyser in SQL 2005
do you know where it is ?

thank you

View 2 Replies View Related

Query Analyser QUestion

Mar 28, 2004

Hi all

I am a novice to SQL Server 2000
Is there a quick reference somewhere for using Query Analyser??

I need to declare variables and pass them into a store procedure.

say if i have the following procedure showing only the input variables/

CREATE PROCEDURE CalcLocalTime
(
@postcode int,
@sDate datetime

)


also how do i display a return variable?


James

View 4 Replies View Related

Cant See From Query Analyser The Text...

Jan 24, 2006

In a field there is a very long text. I am trying to retrieving using query analyser but again it gives me only part of the document...

any help please?

View 8 Replies View Related

Query Analyser Not Running

Mar 18, 2006

Hi


I am install sql 2000, Server is running properly
but query analyer is not working...


Thanks


ASM

View 9 Replies View Related

Prompt In Query Analyser

Feb 5, 2007

Is there antway I can get the Query Analyser to prompt me with a message saying '234 records will be updated' and then give me the option to continue or not.

I want to run an update query but want to see how many records it will update first.

View 7 Replies View Related

Query Analyser In 2005 ?

Apr 18, 2007

Hi:
I am a Sql server 8.0 user,and using query analyser extensively. Is the query analyser available in SQL sever 2005 version ?
thank you in advance.

View 5 Replies View Related

Rollback Via Query Analyser

Jul 23, 2005

HiI'm expecting the answer no here but its worth asking.If I wanted to test an arbitary program could I somehowsay in query analyser, start a global transaction on thisdatabase, run my tests, then at the end roll it back from withquery analyser?I know I can use backup and restore but this would beeasier, still, again, I don't think you can do this.TaF

View 1 Replies View Related

Query Analyser 2000 Vs 7.0

Jul 20, 2005

ISTR QA running in 7.0 would return print statements and messages as thequery ran (well, after a "GO" statement anyway). In 2000 it doesn't returnany messages until after the entire query batch has completed. In wanting tokeep an eye on progress on long batches, how can I make 2000 work more like7.0 in this respect?

View 3 Replies View Related

SQL Timeout Through ADO But Not From Query Analyser

Jan 12, 2007

I have a strange problem running a stored proc in SQL 2000. The proc returns XML and I'm using ADO to call the proc and return the data as a stream. When I call the proc through ADO, it times out because it is taking 40 seconds to run and my command timeout is set to 30. I can increase this no problem but the strange thing is that when I run the same proc from within query analyser, it completes in under a second.

I put profiler on it tracing the command start and finish events and it's definitely taking 40 seconds between start and finish. The proc is used with various input parameters and the timeout is only occurring for some combinations of inputs, but it always seems to take much longer than it does when run from query analyser.

Can anyone suggest what might be causing the delay, or where I might look to find the problem?

Thanks...

View 13 Replies View Related

Query Analyzer. Error : Unable To Connect To Debugger

Jul 23, 2005

MS SQL Server 2000 SP3Windows XP SP2Error when try to debug in Query Analyzer:Server: Msg 504, Level 16, State 1, Procedure sp_sdidebug, Line 1[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect todebugger on HORNET (Error = 0x80070005). Ensure that client-sidecomponents, such as SQLDBREG.EXE, are installed and registered onEUGENE. Debugging disabled for connection 63.Tried:- 'Troubleshooting the Transact-SQL Debugger' ( Book on-line )- EXEC ... 'legacy_on'- firewall is disabledWhat else can be done ?Thanks , Eugene

View 1 Replies View Related

Query Analyser Execute Sequence

Jan 4, 2001

Howdy

If I have serveral queries as shown below:
================================================== ==========
USE XXX
SELECT XX_ZZZZZ, XX_YYY, XX_XXX
FROM ZZZ_ZZZZ_ZZZZ
WHERE QQQQQQQQQQQQQ ='PGL'

USE XXX
SELECT AAA_AAAAA_AAAA,AA_BBB, CC_DDD
FROM SSSS_SSSSS_SSSSS
WHERE FFF_FFFF ='A'
================================================== ===========
Can anyone tell me if the queries execute concurrently or
is it one after the other?

Many thanks,

W.

View 1 Replies View Related

Truncate Transaction Log Through Sql Query Analyser

Oct 20, 2005

Hi guys

My website is in asp and sql2000. My problem is the ISP gave access to database through query analyser. some days the transaction log is growing too high. so i want to clear it. i call up them and clear it. My question is can truncate the log file through query analyser ?
I had limited access to database.

Jini

View 11 Replies View Related







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