Please look at the code at the bottom of this procedure (UPDATE
COVENANT PRINT DATE). When I put it at the tope of this section, it
does the update and fails to return the SELECT results. When I put it
at the bottom, the SELECT returns results and the UPDATE fails.
Can anyone suggest what might be causing my problem?
Thanks
/************ SPECIFIC PROGRAM SEARCH ************************/
IF @PRG_ID != 0 -- PRG_ID supplied
BEGIN
SET @strWHERE = 'WHERE PRG.PRG_ID = ' + cast(@PRG_ID as varchar(15))
EXECUTE (@strSELECT + ' ' + @strFROM + ' ' + @strWHERE + ' ' +
@strORDERBY)
RETURN(0)
END
/************ NON-SPECIFIC PROGRAM SEARCH ************************/
IF @ORG_ID != 0 -- Add ORG_ID to where
IF @intAND = 0
BEGIN
SET @strWHERE = @strWHERE + 'ORG.ORG_ID = ' + cast(@ORG_ID as
varchar(15))
SET @intAND = 1
END
ELSE
BEGIN
SET @strWHERE = @strWHERE + ' AND ORG.ORG_ID = ' + cast(@ORG_ID as
varchar(15))
END
IF @PRG_Closed != 2 -- Add PRG_Closed to where
IF @intAND = 0
BEGIN
SET @strWHERE = @strWHERE + 'PRG.PRG_Closed = ' + cast(@PRG_Closed
as varchar(15))
SET @intAND = 1
END
ELSE
BEGIN
SET @strWHERE = @strWHERE + ' AND PRG.PRG_Closed = ' +
cast(@PRG_Closed as varchar(15))
END
IF @strWHERE != 'WHERE '-- if some parameters supplied..
BEGIN-- Execute search
EXECUTE (@strSELECT + ' ' + @strFROM + ' ' + @strWHERE + ' ' +
@strORDERBY)
RETURN(0)
END
/************ UPDATE COVENANT PRINT DATE ************************/
-- Added by JSHAW 02/25/2004
IF @PRG_Covenant != 0 -- PRG_Covenant supplied
BEGIN
--SET @ORD_Date = GETDATE()
UPDATE PROGRAMS
SET Covenant_Printed = convert(char(10),@ORD_Date,101)
WHEREPRG_ID = cast(@PRG_ID as varchar(15))
END
GO
What is the command to stop a stored procedure from continuing to run? I have a procedure that has a problem, and due to a bug it runs wild in some scenarios, so I need to be able to stop it.
I am trying to use the Transact-SQL debugger to step through a stored procedure on a server to determine where it is failing. I right-click the stored procedure I want to debug in the Query Analyzer's Object Browser and choose Debug... In the Debug Procedure dialog I fill in the values for the parameters, choose the Auto roll back checkbox, and press Execute.
The T-SQL Debugger screen comes up with my stored procedure and a message on the bottom of Waiting for user input. But I can input nothing, neither click on the icons on top, set breakpoints, or doing anything else, as the stored procedure runs to the end and gives me the return code.
If I subsequently set some breakpoints in my stored procedure and try the Go button. Once again the stored procedure runs to the end without stopping at any breakpoint.
In both cases, the stored procedure shows the waiting icon as it proceeds to the end, so that I can not click on anything to stop it.
I have been told this is may be a permissions issue between myself as a client on my machine and the stored procedure on the server. If so, does anybody know what I the things that have to be done on the permissions side to be able to debug the stored procedure using the Transact SQL debugger.
Hi, I am unsure whether i can delete some system created tables from a database.
I was testing replication and then used the wizard to disable it all. I am however left with three tables that are replication based that have not been deleted. they are : MSreplication_subscriptions MSsubscriptions_agents MSsubscriptions_properties
these tables are causing problems with some third party software due to the length of their names. I have tried to 'Exec sp_rename' but i get an error saying the objects are not valid for this operation.
Can i just delete them or will this cause problems if i want to start up replication in the future?
In query analyser, I can stop a script with the "return" statement butif the script contains multiple batches (separated by GO) then thereturn statement only stops the current batch.Is there a way to stop the whole script?
Anyone got any "gotchas" or "nightmares" they want to share out of experience where the services have been shutdown without the proper forethought?
I'm trying to put a case in for a SQL DBA to be paged and to be in charge of shutting down the services and/or put together a checklist of things to verify first.
While I realize shutting down the services is supposed to be a graceful shutdown process I'm willing to bet there are a host of considerations.
hi, i am having sql7 with sp2. Recently our server got bounced back. No body stopped the server, there are no work load at that time. Server suddenly stopped and started. It is weired. Can anyone have any clues , how it happened and why it happened. Thanks!
Recently upgraded a 6.5 server to a 7.0 server. (same server) When we try to stop the 6.5 service, the 7.0 service stops too. Why is this happening? Aren't the 6.5 and 7.0 installations supposed to be independent of each other once the upgrade is done.
Further we would like to uninstall the 6.5 server from the machine as it is no longer being used. What considerations need be taken into account in our scenario.
I've been running SQL Server for 5 years now and have not seen the following.
We have a scheduled night run task where we do various maintenance functions as well as print out the issued insurance policies for the day. All indications are that the run completed except that I did not get an email notification of success or failure.
When I went to enterprise manager, under jobs the night run seems to be stuck in the mode of "Performing completion actions". I cannot get it our of this mode back to "Not running". Trying to stop the task has no effect.
Any ideas/suggestions??
Thanks in advance.
Cheers, Mike Byrd Information Systems Manager Texas Windstorm Insurance Association Austin, Texas
I have searched google and have found no real answer to this....
We are creating a database to support an application which is loading in data as part of the cutover from their current db to SQL Server.
The datafile is around 56GB and when the data processing occurs, as its not just inserts, the transaction logs fills out to around 65GB, and probably more, just that we ran out of space. So question is, is there a workaround for stopping the logging of this processing at all. I have seen that bulk-logged mode may be used, but the option with TABLOCK must be used, and there is no way to get hands on code which performs this processing.
Is there a way to turn off transaction loggin at any point?
I have a SQL Server agent that keeps stopping for no reason. It happens about every other day. I have to go in on the server and manually start it. What would cause this to happen? We have about 50+ computers that need to sync with the server and do so successfully without having to manually start the agent every other day. How do we fix it?
We have a console.php which takes in SQL queries and displays them in aresult.php webpage.Sometimes the query takes minutes to execute or crashes the PHPapplication. Is it possible to cancel a query during execution?If yes, how does one go about it.The PHP Console is used by multiple users simultaneously.The queries are executed on a Remote Database.
My problem is primarily with SQL backup but the instant question is with mirroring in SQL 2005. I have a log file that is out of control and I need to do a backup with truncate_only, but this is command is evidently disallowed while mirroring is enabled. Is it possible to temporarily deactivate or remove mirroring in order to get the backup log under control? Is it possible to do that and then 'resume' mirroring?
A secondary issue is that I don't think mirroring is actually working at this point in time anyway. In the Mirroring section of the database properties the Status window says "No connection: cannot connect to the mirror server instance," so the question of stopping and restarting may be moot.
How does one reestablish mirroring if the connection is lost?
Lots of questions, I know... I'm reading up on it, but I'm obviously not the guy who set it up in the first place! Thanks in advance for any help...
Maybe I'm just totally not getting it, but can someone tell me how to stop/start the distribution agent? The Books Online document - "How to: Start and Stop a Replication Agent (SQL Server Management Studio)" - shows how to stop/start the Snapshot Agent, Log Reader Agent and Queue Reader Agent, but not the Distribution Agent. Is it that stopping one of these agents in turn stops the Distribution Agent. I am trying to work through how to add an article to a peer-to-peer topology and need to stop the agent as part of that.
I'm trying to debug stored procedure code with SSDT, but the debugger don't stop at the breakpoint.
I imported the schema of northwind database from Denali to a new database project and used Run to publish it to localdb.
So, I inserted a breakpoint in SalesByCategory stored procedure, opened a new query window, write an execute statement and started the execution with debug.
The debugger stop at the exec statement, but never get into the stored procedure. I'm using a breakpoint in the stored procedure, already tryed F5, F11, nothing works.
Application Debugging option in localdb is checked.
The operating system is windows server 2008 R2. I'm still using CTP 3.
Hi am trying to create a snapshot (Merge replication) - My database is approx 6GB and one of my tables has 14.5M records - I have a total of 1500 articles to replicate.
When I start creating the snapshot - it seems to just stop on the Table that has the 14.5M records. When I delete all the data in that table it works fine. I have also check disk space and also the log files and tempdb size and all seem ok.
I am using SQL 2005 with the latest SP
Is there any form of verbose logging that I could enable to let me see what is going on
I am using a drop down list box to select values from an SQL 2000 DB. I have put a record into the table which says"...Select Item"I used the dots so that It will apear at the top of the list and therefore display at startup. I also have a gridview to allow users to edit and delete from the same table.I am worried that a user may accidently delete the "...Select Item" row from the table.Can anyone think of a way round this? Is it possible with SQL Server 2000 to stop a single record from being deleted?Any help would be most appreciated.ThanksPaul
What problems could be invoked by stopping SQL Server and copying a user databases data and log files and pasting these files over existing files on another machine.
Ex: MyDB on Server1 MyDB on Server2 Stop SQL Server Server1 and Server2 Copy Server1.MyDB files Over write Server2.MyDB files Start SQL Server Server1 and Server2
Make sense. This scenerio seems to work but wonder what side affects could result.
If I stop MSSQLServer service on my SQL7 server using net stop and then restart it seconds later with net start, how will this affect my users ? Will they notice this ? Gets disconnected ?
Hi all, I'm trying to debug storedprocedures in query analyzer from workstation, login with server adminuser.Debugger is not stoping at break points. any help regarding this will be greatly appreciated. thanks.
We have implemented a simple form of failover which combines daily full backups, differentials every 10 minutes and log backups every minute. We developed this form of "poor man's replication" because we will be deploying 3,400 instances of SQL in our retail chain.
The event log is cluttered with "Database Backedup" messages from all of these backups. I altered the messages to "no log" but they continue to appear. Is there any way that I can disable these messages or are they hard wired?
I wonder if you can help me with a problem I have trying to support a web based application that uses SQL 2005.
The problem is that the application developers tell me that it is neccessary to stop and restart the SQL service as part of the troubleshooting process when their application stops working. Unfortunately, the customer has our application database on a clustered SQL instance that is used by other applications so they cannot just stop and restart the SQL service because this will have a major impact on all the other instances...
Is there another way that would effectively do the same thing as stopping and restarting the SQL service? I have read that dettaching and re-attaching might do the same but application developers say onlt stopping/restarting services is sufficient to break the connection with the application.
Any advice would be really welcome as I am completely new to SQL and struggling with this!
I have SQL2000 server installed and then SQL management studio 2008 R2 express edition in users desktop. I noticed that the user can stop the SQL server agent. Even a user is a reader access only.
I'm hosting sqlserver 2005 developer edition locally on windows vista.
I'm getting messages for allot of stuff.
I can't restart, stop, or start my sql server instance.
I can't start the full-text search service.
I get this when I try to start the full-text search service.
===================================
Unable to start service MSFTESQL on server PAUL-PC.
===================================
Access Denied (ObjectExplorer)
------------------------------ Program Location:
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.CheckServiceActionReturnValueSuccess(UInt32 returnValue) at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.Start()
And when I try to restart the instance...
===================================
Unable to stop service MSSQLSERVER on server PAUL-PC.
===================================
Access Denied (ObjectExplorer)
------------------------------ Program Location:
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.CheckServiceActionReturnValueSuccess(UInt32 returnValue) at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.Stop(Boolean stopDependentServices)
Environment:SQLServer Developer Edition on Machine AEnterprise Manager running on remote machine BBoth machines are in the same subnetI open Enterprise Mgr on Machine A, right click on the Stored Proc, enterthe parameters and the debugger stops on the first line and I can singlestep through it just fine.I open Enterprise Mgr on Machine B and connect to the same database onMachine B, right click on the same Stored Proc, enter the same parametersand the debugger doesn't stop, but it runs the proc al the way through.Even if I set a break point on one of the lines from this machine it doesn'tstop. I don't get any errors, it just runs right thought the proc.I've been through all the DCOM settings, Logins with Admin rights and not aSYSTEM account. Checked all the debug files and have them all registered.Anyone else expericened this? Anyone have any ideas on how to fix it?-Steve