Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Different Results In Query Analyzer And .net


ok the following statement returns the correct results in sql query analyzer but in the .net environment with c# it returns back less 3 records

SELECT SUM(ao.amount),bl.dpc,bl.city from billinglocation bl
 inner join shippinglocation sl on  bl.billinglocationid = sl.billinglocationid
 inner join absorbentorder ao on sl.shippinglocationid = ao.shippinglocationid
 group by bl.dpc, bl.city

billinglocation 1 - 1 shippinglocation 1 - many absorbentorder

anybody have any ideas why this might be occuring
thanks!




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Query Analyzer- Results
I have a SP that will return huge amount of data. How do I get this data to a file? Basically I cannot use "Output to file" option. IfI use that, I will get the output that is from the "Grids" table and not from the "Messages" tab.

I want the output that normally is seen on the "Messages" tab.

Thanks in Advance.

View Replies !   View Related
Easy SQL Question. How To Display Query Results In Query Analyzer
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 Replies !   View Related
Formating Results In Query Analyzer
I have a table as follows:
A NO Balance [decimal (16,5)]
---------------- -------------------------------------------------- ------------------
18.00 001000000000000 -37.982
19.00 002000000000000 -17.656


In the Query analyzer when I try:
SELECT * FROM TABLE1

A NO Balance [decimal (16,5)]
---------------- -------------------------------------------------- ------------------
18.00 001000000000000 -37.98
19.00 002000000000000 -17.66

I need the query analyzer to format them as they are in the tables.
Help please.

View Replies !   View Related
SQL Query Analyzer - Results In GRID
I get column headings when I execute a query using the GRID results mode; but when I save the results into a file the headings are not saved.
(I have used the TEXT results mode and it works fine.) How can I get column headings when saving results from a GRID mode into a file?

TIA,

Peter

View Replies !   View Related
Print Results From Query Analyzer
Hi everybody,
When I run my query analyzer I am getting results in the bottom window.
How can I print results in that situation.
Any ideas?
Thanks,
Rudi

View Replies !   View Related
Funny Results In Display Execution Plan In Query Analyzer
Working with SQL2000 SP2, I get strange results whenever I try to use the Display estimated execution plan command in Query Analyzer.

Many operations appear as 0% (if only this were true!) whereas others can appear with 300% or 500%, and this doesn't necessarily have any connection with the real entity of work involved.

I haven't found any reference to this problem on the Microsoft site nor in these discussion groups, am I the only person in the world to have this problem?

Or maybe I am the only one who uses this functionality?

Anybody know any fixes?

Thanks

David Westmore

View Replies !   View Related
Is There A Way To Hold The Results Of A Select Query Then Operate On The Results And Changes Will Be Reflected On The Actual Data?
hi,  like, if i need to do delete some items with the id = 10000 then also need to update on the remaining items on the with the same idthen i will need to go through all the records to fetch the items with the same id right?  so, is there something that i can use to hold those records so that i can do the delete and update just on those records  and don't need to query twice? or is there a way to do that in one go ?thanks in advance! 

View Replies !   View Related
Need To Display Results Of A Query, Then Use A Drop Down List To Filter The Results.
Hello. I currently have a website that has a table on one webpage. When a record is clicked, the primary key of that record is transfered in the query string to another page and fed into an sql statement. In this case its selecting a project on the first page, and displaying all the scripts for that project on another page. I also have an additional dropdownlist on the second page that i use to filter the scripts by an attribute called 'testdomain'. At present this works to an extent. When i click a project, i am navigated to the scripts page which is empty except for the dropdownlist. i then select a 'testdomain' from the dropdownlist and the page populates with scripts (formview) for the particular test domain. what i would like is for all the scripts to be displayed using the formview in the first instance when the user arrives at the second page. from there, they can then filter the scripts using the dropdownlist.
My current SQL statement is as follows.
SelectCommand="SELECT * FROM [TestScript] WHERE (([ProjectID] = @ProjectID) AND ([TestDomain] = @TestDomain))"
So what is happening is when testdomain = a null value, it does not select any scripts. Is there a way i can achieve the behaivour of the page as i outlined above? Any help would be appreciated.
Thanks,
James.

View Replies !   View Related
Re-display Result Set Without Re-running Query In Query Analyzer?
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 Replies !   View Related
Query Analyzer Runs The Query Instantly But ADO Can Take Forever???
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 Replies !   View Related
Determine Fastest Query In Query Analyzer
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 Replies !   View Related
DTS Data Driven Query Vs. Query Analyzer
I need to update two fields in a few hundred rows in a table. I'll beprovided with a spreadsheet giving me the key field and the two newvalues for each row. In the past I've done this simply by adding extracolumns in Excel to construct a T-SQL UPDATE command for each row, thenpasting into Query Analyzer to run the whole lot.I've come across the Data Driven Query task in DTS but wonder if I needto use it for such simple updates. Would the DTS route give me anyadvantages or make it easier to repeat the task in future?ThanksMark

View Replies !   View Related
Query Differences Query Analyzer Vs Php-file?
hi,I'm having trouble with a query. running it in SQL Server 7's QueryAnalyzer gives me the correct output, but when I put that code insidemy php file it won't respond the same way. How come? The query:$query2 = "INSERT INTO bestilling (mid, orgid, bestilt)VALUES('$nymid', '$orgid','1')";the last column(bestilt) will get the value NULL through my php, and 1(as I would like it to) through the Query analyzerobscurr

View Replies !   View Related
Query Analyzer Crashes When Saving Query
Has anyone had the problem of QA crashing whenever you try to save a query? This is a full application crash, where the only way to close down QA is to use Task Manager to end QA (which is shown as not responding). This happens every time I try to save a query, even though the query saves successfully. Unfortunately, if you have several queries that need saved, you can only save one before it crashes. So you lose the other queries.

View Replies !   View Related
Query Analyzer, Slow Query Responses
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
SQL Query Analyzer
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 Replies !   View Related
Where Is Query Analyzer?
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 Replies !   View Related
Is There A Query Analyzer
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
SQL 7.0 Query Analyzer
Recently started using this as a front-end with our SQL 6.5 servers (no 7.0 in production yet). It's a pretty nice tool in many ways, not the least of which is performance. I think the client is at least twice as fast at processing result sets as ISQL/w, or any other front-end tool I've used recently.

So I'm wondering how Microsoft achieved this ... what language/technology was used to build the query analyzer? What allows it to process result sets so much faster than anything else I've seen?

- Mike

View Replies !   View Related
Query Analyzer Won't Run?
A strange problem has surfaced. Query Analyzer (ISQLW.exe) won't run as an
application.
I can run Enterprise Manager, browse servers, databases and tables.
I can right-click on a table and view the data in the table, both on local and remote servers.
But, if I try running Query Analyzer, the hourglass shows for some 5 seconds then disappears. Task Manager shows ISQLW running as a process but not as an
application. The same happens if I try running it direct from its folder.

Has anything similar happened to anyone else?

The only thing I've done that might be related, as a network issue, is that I
added the Lookback Adapter as a network device so that IIS5 could work on the PC while stand-alone and not connected to the LAN. But I've deleted it since, and the SQL problem remains. Very strange.

View Replies !   View Related
Query Analyzer
Hello I am a beginner to SQL Server and I am having trouble getting query analyzer to do what I want it to do. When I run a query and export it as a tab-delimited .rpt file it is alright except for at the very bottom
it says something like this '(47 row(s) affected)'. Is there a way I can setup query analyzer so it doesn't do this?

Thanks
Eric

View Replies !   View Related
QUERY Analyzer Help
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 Replies !   View Related
Query Analyzer
I have the following code in Query Analyzer


Declare @PATID varchar(15)
EXEC GetNextPatientID 'BAR', 'PAT', @PATID


@PATID is the output variable, after the procedure has executed I want
to display the value in @PATID.

Anybody know how I go about doing this?

View Replies !   View Related
Query Analyzer...
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
Little Help With Query Analyzer
 

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 Replies !   View Related
SQL Query Analyzer
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 Replies !   View Related
Query Analyzer Help
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 Replies !   View Related
Query Analyzer
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 Replies !   View Related
Help With SQL Query Analyzer
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 Replies !   View Related
Query Diff Results From Ent Manager Query And Query Analizer
ok can someone tell me why i get two different answers for the same query. (looking for last day of month for a given date)
 
SELECT     DATEADD(ms, - 3, DATEADD(mm, DATEDIFF(m, 0, CAST('12/20/2006' AS datetime)) + 1, 0)) AS Expr1
FROM         testsupplierSCNCR 
I am getting the result of 01/01/2007
 
but in query analizer I get the result of
 
12/31/2006
 
Why the different dates
 

View Replies !   View Related
Need Help Getting A Return Value In SQL Query Analyzer
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 Replies !   View Related
How To Debug In Query Analyzer?
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 Replies !   View Related
Works In Query Analyzer But Not In SP
Hi I have a following SP that does not return results. Could somebody tell me what I am doing wrong here.


CREATE procedure dbo.wfiDocuments_Get
(
@ModuleIdint,
@PortalIdint,
@IsActivebit=NULL
)

AS

declare @SQL nvarchar(4000)

SET @SQL =
'select
DocumentId,
ModuleId,
PortalId,
CreatedByUserId,
''CreatedByUserName'' = Users.FirstName +'' '' + Users.LastName,
CreatedDate,
Title,
Category,
Syndicate,
Clicks,
Size,
Description,
FileName,
VPath,
IsActive
from wfiDocuments
left outer join Users on wfiDocuments.CreatedByUserId = Users.UserId
where PortalId=@Portal and ModuleId =@Module'


IF @IsActive IS NOT NULL
SET @SQL = @SQL + ' AND IsActive=@Active'

SET @SQL = @SQL + ' ORDER BY Title'

EXEC sp_executesql @SQL,
N'@Portal INT,@Module INT,@Active bit',
@PortalId,@ModuleId,@IsActive
GO

View Replies !   View Related
Insert Row In Query Analyzer
Hi there !

I have a table called customer which got
id = int
name = varchar
address = varchar
email= varchar

can you please write the syntax that insert the below data in the table using query Analyzer

id = 1
name = fadil
Address = London
email = fadil1977@hotmail.com


Thank you for your time and help.

View Replies !   View Related
Query Analyzer Locks Up!
Hey all,I'm having this weird problem on my Windows 2003 Server machine..Whenever I open two connection pages in Query Analyzer, then close oneof them, it locks up and I have to kill the task.I read a posting somewhere that said this could be due to an MDACinstallation problem, but I've run MDAC Component Checker and all filesare ok, version 2.8. Also, since I'm running Windows 2003 and MDAC 2.8is the latest, I can't reinstall it.There has to be some other cause for this. Why would QA lock up everytime I close a page?-John

View Replies !   View Related
ODBC In SQL Query Analyzer
Is there any way to use an ODBC data source in MS SQL Query Analyzer? Ineed to join an MS SQL table with a table from a non MSSQL database.DTS would allow me to import the alient table but I want to avoid that,if possible.thanks

View Replies !   View Related
SQL Query Analyzer Greyed Out
If I open Enterprise Manager through a saved MSC file, the Tools > SQLQuery Analyzer option is greyed out (unavailable). If I open EnterpriseManager from the Programs menu, Query Analyzer is available. Is theresomething specific I need to do with msc?I created an MSC file and added the Enterprise Manager snap-in.

View Replies !   View Related
Query Analyzer On 2003 WE
Hi -The developers in my company are all switching to Windows 2003 WebEdition for their dev machines so they can better target the platform.Unfortunately we have discovered that we unable to install the SQLServer tools due (Query Analyzer, Profiler, etc) to the restrictionthat SQL Server is not allowed. The devs run their databases on acenteral server. Is there any workaround[1] to allow just the tools on2003 WE?Thanks![1] Installing another version of 2003 (Standard, Enterprise) is not angood option since a) that isn't what our production servers run b) theadmin doesn't want to give the devs the ability to do something stupid,like turn their desktop into a domain controller.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved