We're using SQL Server 2000 and we'd like to be able to track our view
usage to tell which of our views get used most often. This will help
us determine which views we need to concentrate on first for
optimizing, indexing, etc... Does anybody know if there's a way to
tell when a view is opened?
I can get a snapshot of tables in tempDB, but I would like to track which procs are causing the load in the tempDB.
I think I can sample and record objects in the tempdb, but I would like to record the proc creating the most tempDB usage, and disk read/writes associated with those procs.
The DMV's give usage in the individual DB's, but what's a good way to correlate procs in the DB's to tempdb usage?
I am using Northwind database to Create a view showing every order that was shipped to Spain. Name the destination column 'DestinationSpain'. Include code that checks if the view already exists. If it does, it should be dropped and re-created.
Here is my script:
use Northwind GO
/*STEP 2, #1*/
/* does it exist, if so drop it */ if exist (select * from dbo.sysobjects where id = object_id(N'[dbo].[OrdersToSpain]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[OrdersToSpain] GO
/* Create the View */ create view "OrdersToSpain" AS SELECT Orders.OrderID AS Order_ID, Orders.CustomerID AS Customer_ID, Orders.OrderDate AS Ordered_Date. Orders.ShippedDate AS Shipped_Date, Orders.ShipCountry AS DestinationSpain FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Orders.ShipCounty LIKE '%SPAIN%' GO
Here are the errors I am getting:
Server: Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword 'select'. Server: Msg 170, Level 15, State 1, Line 6 Line 6: Incorrect syntax near ')'. Server: Msg 170, Level 15, State 1, Procedure OrdersToSpain, Line 7 Line 7: Incorrect syntax near '.'.
I am maintaining an application where most of the business rules are inTriggers, Stored Procedures and User Defined Functions. When a bugarises, it can get very tedious to debug. Today for example, I wantedto modify a function that was being called by a trigger. The problemis that I don't want to change the function, for fear that it is beingcalled by one of the other SP's or triggers in the database (there arehundreds of them)Essentially, I need a tool that allows me to view where functions andsp's are being referenced from. At the very least, I'd like to performa "full text search" in the database objects, so that let's say I havea function named "fn_doSomething", I can search the schema for thisstring and get all the places where it appears.As you can see, I'm in the dark here. I've never worked on a systemwhere all business rules are at the database level. If you know of atool that does what I describe above, or anything else that wouldfacilitate my life, please let me know!Thanks for your help,Marc
I have a client program that writes to sql server database 10 records per second . i want to compute the CPU usage and the memory usage for the whole program or CPU usage,memory usage for the insert statement in the program .
Hello, When I am seeing SQL Server 2005 Management studio Server Dashboard> I am seeing my(USERS) databases and msdb database usage is very small % of in CPU Usage(%), Logical IO Performed (%) Usage pie chart.
90% of Total cpu usage is showing for Adhoc Queries. what excatly this means in Dashboard? if application uses more than it would have shown in Database level or not?
sicerely this dashboard is good, if any one is watching daily, please advice their experiences here.
hi, Is there a way to view any Transact sql in a log for instance, I am iserting a new records into a table. how can I track a log for the isert statment. I know that using bcp code provides me with a log if I use /o in the bcp code. Is there any similar thing for Transact sql thanks Ali
hello,I was wondering how to track all changes on tables by using some sort of ahistory table.What i would like is a generic history table where i can see who updated,inserted, deleted or executed(stored procedures, triggers) what value inwhat table with a date when it was occured.Could somebody help me with this?
A stored procedure has been executed either yesterday or today. I would like to find out which user and when they executed it. Is this possible without 3rd party transaction log interrogation tools?
What would be the best practice to follow to keep track of MS SQLserver changes... Stroed procs, tables, views, triggers, indexes, DTSand also jobs ect....I am not quite sure how Source safe works with sql server. Any otherway to do this... Even if its manual work, its okey.. I wouldappreciate if any of the DBA's let me know how they are facing thisissue....Thanks in advance...
While my application is running on the production server, I want to develop on the test server. After a few weeks, I want to update the application, and have to update the database structure on the production server also with the most recent one from the testserver, but without deleting the current data on the production server.
I create/modify all tables in SQL Server 2005 via Management Studio. The application is built in VS2008 Pro. I'm using SubVersion (SVN).
I can let Management Studio generate scripts for every change and store them manualy, but that's a little bit too much work. What I want is a sort off version control solution. A solution that a service running on the background tracks every change on a specific database on my test server, and stores them as T-SQL code in a repository. Then I can collect all those T-SQL scripts, and run them against the production server.
I want to create a page(using GridView) where it will detect changes made in the database and display it for Administrator observation. I've created a table name history for this purpose. History guid (uniqueidentifier) dateCreated(datetime) lastDateUpdated(datetime) changesMade(varchar(50)) ---- eg; dropdownlist oldValue(varchar(50)) ----- compaq newValue(varchar(50)) -----dell updateBy(varchar(10)) <------ username of registered user comNo(int) = foreign key for Computer table History data will insert data whenever a changes made. Could anyone advise and direct me how to do this function. I was thinking of using stored procedure to insert the data. Thanks in advance.
I have an application that has a SQL back end, and I want to be able to track who is accessing a record so that no one else can access it at the same time. I was going to do this with a table or application state, but how can I avoid keeping files locked when someone abandons a session? Any Ideas?
I have a stored procedure for which i need to track the changes. I wanted to know which user has updated the stored procedure and what all changes are done to it. I thought of getting these details from the transaction log, but looks like sql server 2000 doesnt have any log reader.
Hi all, I have a data of applicants. Everyday we dump this data into SQL server. Now I need to generate reports everyday so that we can track how many records get updated everyday. Now the thing is that the applicants are in various stages. So my reports need to track the how many applicants changed from stage "abc" to "pqr" and how many changed from "pqr" to "xyz". Now it is not necessary that all the records change stages everyday.
I need to be able to track which users and the number of times a user connects to a particular SQL Server database. I have a simple SQL Server database that users query (SELECT only) using an Access 2000 front-end. I do not have any control over the front-end so my only tools on the database side. I can't use 3rd party software, just SQL Server. Is there any way? Thanks.
I have a requirement. I am having a database which is having views,procedures and tables. Many users are having access to the database. If i want to track all the schema changes happening in the database how to achieve that? As in i have used some tables in a procedure and someone might change the column or drop the column. So it is going to have impacts on my procedure. I need a trigger which tracks all the changes done in a database and the impacts those changes are going to make.
Considering that sql server Update is a chained Delete and Insert, the first row is the delete row capture and the second one is the insert row capture.
But I don't understand why the address is tracked as NULL when I update other fields.
I have a strong feeling that this isn't possible but I thought I might as well ask...
I'm developing a database application (SQL Server 2000 backend) where the client and the server is separated over a slow network connection (satellite). There are parts in the application where I will have to query a large resultset so I was wondering if there is a way to determine the percent complete of a query so I can put a progress bar on the interface so the user can see it loading data instead of having a frozen form.
I thought about spliting up the query into different ones and update the bar once each separate one is complete but I'd rather not do that because in the application development environment I'm working in, I have to close the resultset and reopen it every time I do a query... unless this isn't a big deal but I'm under the impression its something to avoid.
different Users are running select statements under their own login. they have readonly permission to the database. My goal is to track all those queries and send notification which tables were opened and which columns were displayed...Looks like I need trigger on select statement for the table...( Unfortunetely it doesn't exists) I collect all those statements in trace file and in the night time I stop trace, move file data to table and then step by step try to massage sql queries using VB.net... Most of those queries are so complicated, have derived tables inside and it is really hard to parse these sql statements... 1.If anybody has an idea how to say: User B opened table tbl_A col_B twice per today...using different methodology rather then go through SQL.(Other words how to create an event on a table which will be fired in a case of request select any column of that table?) 2.If somebody know where we can take good parser which will help with this job? Thanks
I am an advanced user of MS Access and other databases but relatively new to SQL Server. I am utilizing SQL Server Express to analyze a database that was created by another entity. I am interested in looking at any specific record in any table and seeing who created that record, what date/time the record was created, who edited the record, when that edit occurred, etc. I don't see any such fields in the database. Would the designer of the database have to have explicitly added such functionality, or is this information available but just hidden from the novice's view?
Hello there,Does anyone know of a way to track changes to an SQL Server database so thatI can easily run those changes at a later date?That is, I want to make schema changes, and record those changes so that Ican execute them 6 months later on a copy of the orignal database.Thank you kindly for any ideas anyone may haveJohn
I have a problem concerning keeping track of a value within a query. I have a table that tracks invoices recieved and payments made. For each invoice number there may be multiple payments made against it. I need something that will check and make sure that each invoice number has its payments equal to its received amount.
Is there any method to track stored procedure changes?
Basically I want to save a copy of stored procedure definition in my own table whenever a stored procedure is being created/updated/dropped from the database.
Thanks.
P/S: Table to keep the copy
CREATE TABLE USP_HISTORY(
UserID nvarchar(128),
ActionType varchar(10),
ActionDate datetime,
SPName nvarchar(128),
Definition nvarchar(MAX)
)
ActionType stores value like Create or Alter or Drop
I have a large "view" I'm working with, between 250-280 fields [not sure exactly]. Within this view there are a few fields with similar information. For example, LocationID corresponds to the Address, City, and State, but those three are seperate fields.
I also have a field with the most recent date and time that the address was used. There can be multiple records for any address if the address was used more than once in any given month.
What I need to do is pull each distinct address-if there is more than one instance of that address, the instance that was most recently touched, along with all the other 200+ corresponding fields.
I started off thinking I could sort the address ascending, and then the time descending, and just pull the first hit of each address by using the DISTINCT keyword in my query, but it keeps getting thrown off by all of the fields, and ends up not being distinct.
I was using something like this:
SELECT DISTINCT Address, BUnit, ResultDateTime
FROM dbo.vw_ReportData
WHERE BUnit='Blah'
ORDER BY Address, ResultDateTime DESC
Can anyone shed some light on this issue? That where statement needs to be in there [or its effect anyhow]. Any help would be appreciated.
Hello I am using SQL Server 2000 and How should I track a specific procedure and DMLs in it with profiler, I was trying to filer ObjecName=MySP but it seems it does not track only the SP. Any idea?
can any body provide me any idea i need to know who had made changes to any particular stored procedure (when and from whose machine) any thing regarding to any kind of tracking of stored procedure
I have a table full of items which can be searched. I also have another table with the ID of each item and columns for no of times details shown, no of times saved etc.
What I would like to do is increment a value in this second table for each item every time it is returned in a search.