Cannot Run Query From Analyzer In Enterprise Manag

Mar 13, 2006

I am try to do a query of dates.
I have an access adp front end with sql2000 backend
I am trying to query vacation dates.
the start date month and day is based on month(hiredate) & day(hiredate)
i need to find the number of days taken during a specific period
i have to use entering start date and end date and days.

i am trying a query that returns sum of days before the end date changes.

it works in sql analyzer but doesn't when i paste it in EM
doesn't want to save it. it says error by if..



heres the code.



SE EMPLOYEE

IF { fn CURDATE() } > (SELECT distinct cast(Year(dbo.[Employment Information].[Hire Date]) as varchar(30)) + '-' + CAST(DATEPART([month], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(DATEPART([day], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30))
FROM dbo.[Employment Information] INNER JOIN
dbo.[Employee Vacation] ON dbo.[Employment Information].[Employee ID] = dbo.[Employee Vacation].[Employee ID])

BEGIN

SELECT dbo.[Employee Vacation].[Employee ID], SUM(dbo.[Employee Vacation].[Number of Days]) AS [Days Taken]
FROM dbo.[Employee Vacation] INNER JOIN
dbo.[Employment Information] ON dbo.[Employee Vacation].[Employee ID] = dbo.[Employment Information].[Employee ID]
WHERE (dbo.[Employee Vacation].[Start Date] BETWEEN CAST(DATEPART([month], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30))
+ '-' + CAST(DATEPART([day], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(YEAR({ fn CURDATE() }) AS VARCHAR(30)) AND
CAST(DATEPART([month], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(DATEPART([day],
dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(YEAR({ fn CURDATE() })+ 1 AS VARCHAR(30)))
GROUP BY dbo.[Employee Vacation].[Employee ID]
END

ELSE
BEGIN

SELECT dbo.[Employee Vacation].[Employee ID], SUM(dbo.[Employee Vacation].[Number of Days]) AS [Days Taken]
FROM dbo.[Employee Vacation] INNER JOIN
dbo.[Employment Information] ON dbo.[Employee Vacation].[Employee ID] = dbo.[Employment Information].[Employee ID]
WHERE (dbo.[Employee Vacation].[Start Date] BETWEEN CAST(DATEPART([month], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30))
+ '-' + CAST(DATEPART([day], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(YEAR({ fn CURDATE() }) - 1 AS VARCHAR(30)) AND
CAST(DATEPART([month], dbo.[Employment Information].[Hire Date]) AS VARCHAR(30)) + '-' + CAST(DATEPART([day],
dbo.[Employment Information].[Hire Date])- 1 AS VARCHAR(30)) + '-' + CAST(YEAR({ fn CURDATE() }) AS VARCHAR(30)))
GROUP BY dbo.[Employee Vacation].[Employee ID]
END

View 1 Replies


ADVERTISEMENT

Making A Batch File That Will Start A Active Script In SQL Server Agent Through SQL Enterprise Manag

Jun 29, 2000

Hi again!
I would like to thank the 2 persons which I had an answer from my previous question first. Thanks a lot !

But, it didn't quite answer my question so I'll give a bit more info.
I would like to know if I can make a batch file, that excutes or starts an active script in SQL Server Agent (that is in SQL Enterprise Manager).
If I can, can you give me more info on how to do it (command line, parameters), a web site, anything that can help me to that.

If I cannot do that, let me know please.
Thanks a lot!

View 2 Replies View Related

Enterprise Manager / Query Analyzer Tcp/ip

Dec 12, 2000

How can I force Enterprise Manager and Query Analyzer to use TCP/IP?
While my applications connect instantly to the database
after I started using the NTL parameter in connect string, these 2
applications take forever and a number of retries to connect.

Can someone help?

Thanks
Liju

View 2 Replies View Related

Cannot Open Query Analyzer From Enterprise Manager

Nov 29, 2006

After I installed MSDE, I cannot open QA from Enterprise Manager - error message says: the specified file was not found. Any ideas anybody?


Thank you.
Alexander

View 6 Replies View Related

Difference Between Enterprise Manager And Query Analyzer

Jan 24, 2007

Hi All,What are the pros and cons between using Enterprise Manager or QueryAnalyzer for my queries.Currently I use Enterprise Manager because I prefer the interface andonly use Query Analayzer when queries time out in Enterprise Manager,but I'm sure there must be more to it.Regards,Ciarán

View 1 Replies View Related

Enterprise Manager Job Scheduler Vrs Query Analyzer???

Jul 20, 2005

I run a stored procedure manually each day without fail using QueryAnalyzer.I.E. I right click in the browser window on the storedprocedure hit open and execute. I am trying to get my "DBA" toschedule this job in Enterprise manager and they keep getting syntaxerrors that make no sense and keep asking me to fix the code.Is there any difference in how the job scheduler executes a procedurevrs doing it in Query analyzer via Open/Execute that requires adifferent SQL syntax??? Im thinking that this problem is not the codebut a permissions issue What are your thoughts?

View 2 Replies View Related

Viewing Database Via Query Analyzer And/or Enterprise Manager

Sep 20, 2004

We are running SQL 2000 SP3 on a Win2K server with multiple user databases. Our current problem is the ability of users to view the database objects via the native tools.

Example: User Bob
Bob has the following rights:
DB A – datareader/datawriter
DB B – datareader/datawriter
DB C – datareader
DB D – datareader
DB E – datareader/datawriter

The user has no builder rights or server roles.

In Enterprise Manager, the user can not see any databases. In Query Analyzer, the user can only see DB A, B, and C. Anyone seen this problem before and/or have suggestions?

Thanks in advance!

View 3 Replies View Related

SQL Enterprise Manager And Query Analyzer Displaying Different Row Counts

Jul 23, 2005

The row counts I am getting from SQL Enterprise Manager and QueryAnalyzer are different. When I double click a table in EnterpriseManager it gives me a row count of say 1000. However, when I select *from that same table in Query Analyzer it returns 1028 rows. Anyoneknow why or better yet, how to fix it? Thanks!

View 2 Replies View Related

Can't Find Enterprise Manager And Query Analyzer After Setup

Feb 28, 2007

I downloaded the trial version of sql server 2005. but after installation, I couldnt find the Enterprise Manager and Query Analyzer. Any idea about that? Thanks.

View 3 Replies View Related

Enterprise Manager, Query Analyzer, Client Tools Question

Mar 6, 2001

Our installation has two instances of SQL Server 7. We have the client tools associated
with SQL Server 7 on our NT desktop. We will be implementing two servers running
SQL Server 2000 (SMS).

Ideally, on our NT desktop we would like to have one set of client tools (EM, Query Analyzer,
etc.) for supporting both versions of SQL Server.

Do we need both versions of client tools on our desktop?

Will SQL Server 2000 client tools support both versions of SQL Server?

Thanks in advance for your help!!!

View 2 Replies View Related

Query Analyzer Does Not See Enterprise Manager Database And Vise Versa

Jul 23, 2005

I am using SQL Server 2000.I have created a new database in Query Analyzer but I cannot see it inEnterprise Manager.I then created a new database in Enterprise Manager, but I can't see it inQuery Analyzer.How do I get these applications to see the databases that the other creates?Thanks,Greg

View 1 Replies View Related

Default Date Format Difference In Enterprise Manager Vs. Query Analyzer

Mar 13, 2008

Not sure why SQL Server displays different date formats for the same date in Enterprise Manager query window vs. SQL Query Analyzer.


When I see table rows through enterprise manager the date field looks like 3/18/2008 12:30:00 PM

Whereas when I run a query a query in Query Analyser/or through any other application the date is shown in a different format: 2008-03-18 12:30:00.000


Is there a setting in SQL Server that can remove the date format inconsistency?

View 1 Replies View Related

Translating Enterprise Manager And SQL Query Analyzer To SQL Server Management Studio

Nov 13, 2007

Good morning,

I have a project that consists of modifying a report in Crystal. The problem is that I know very little about SQL and I need to add some data items to Crystal using SQL. The guide that I was given refers to Enterprise Manager and SQL Query Analyzer but they have since upgraded to SQL Server Management Studio. Can anyone translate the following statement into SQL Server Management Studio so that I can complete this process?

Best regards,


We will now edit the View on the MS SQL server. Open Enterprise
Manager and find the cst_adEnroll_MyInitials _vw in the Views
section of the database. Right-click, select Copy, then go to the
menu bar and Select Tools and SQL Query Analyzer. Once Query
Analyzer opens: Change CREATE to ALTER before the view name.

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

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

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







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