Can't Kill SPID
Use sp_MSforeachtable to gen COUNT(*) for each table in MyDBname
I'm trying to dynamically COUNT the # rows per table in a DB using sp_MSforeachtable. The following syntax executes DBCC CHECKTABLE for each table in my DB.
HOW can I modify the following SQL to perform a SELECT COUNT(*) from each table in my DB?
USE MyDBnameGO
sp_MSforeachtable @command1="print '?' dbcc checktable ('?')"
/* NOTE:You can issue up to three commands to the stored procedure using @command1 through @command3. */
View referencing table with ## in the name?
Rename Instance of SQL Server
Audit trigger returning multiple records
Take too long to shrink a huge database, HELP!!!!
I have a db size 13.5GB with File Allocation of 29 GB and autoshrink is off.
I am running the following command, trying to shrink the db, but it has been running for over 2 hours now, and last week I have tried this for over 3 hours and I had to stop it.
use [MSQLDB] DBCC SHRINKFILE (N'MSQLDB_DATA', 4000)
Any other way to shrink this big db down? I can't leave it at this 29GB, it is taking up too much disk space on my server now.
Please advise.
Thanks.
Sin
An expression of non-boolean type specified in a context where a condition is expected, near 'AND'.
about sql error
Recover records from delete statement
I ran a delete statement, and deleted all rows.
Can I restore all these deleted records?
We updated the table with a backup from 3.am this morning, which is okay for now.
Thanks!
List SQL Server patches
Before SSMS...Server 7
Network IP address is changing - What is the impact on SQL server?
Dear All,
My company is changing the IP address of our network. So, I have a few questions:
- Do I need to change anything on the SQL servers and clients accessing the SQL server?
- Where do I need to make these changes, and how do I test them?
Are there any articles that explain this?
Your help is highly appreciated.
Thanks.
Merge replication SQL server 2012
SQL 2000 cluster issue
Deny user from running Alter Server Role
Reporting database for an ERP system
Hi,
I've created a reporting database that pulls data from the ERP system using DTS packages. On the reporting database the statistics are 2488 MB for data files and 44563 MB for log files. My question is why is the log file this big and what are possible strategies to managing this log file. Keep in mind that this is a reporting database and I don't need to record every process.
Thanks,
Joe
Error 1222: Lock request time out period exceeded
Our server is set up with connections settings with a timeout of 0 (unlimited). However we have suddenly developed a problem in Enterprise Manager.
When accessing Enterprise Manager, Management, Current Activity, Process Info, we get the error
Error 1222: Lock request time out period exceeded
Refreshing or disconnecting/connecting the server does not clear the error. Users of the production application, which uses that server, are experiencing difficulties but still able to work and log in. There is only the one application on that server.
Has anyone got any ideas? Nothing has been changed in SQL Server for some considerable time.
An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown.
summation of a calculated time difference field
Slow join across SQL Linked Server to InterSystems Cache
Hi Everyone,
I am a newbie to this discussion forum. If I’m bending/breaking any of the rules, please let me know.
I need some major help with a linked server I setup. I have a cache database that we can only access through ODBC (no mumps). I have a SQL database, db01, which is storing data related to a table in one of the cache databases. I setup a linked server on our SQL Server pointing to the cache database using the MS OLE DB Provider for ODBC driver, referencing our ODBC data source.
From SQL Server I can do pass through queries using OPENQUERY and see excellent performance when looking for specific IDs.
/*
SELECT * FROM
OPENQUERY(Cache_test01, 'SELECT * FROM Table01 WHERE ID=22') AS X
*/
Works great. However, whenever I do a simple join between my SQL database and Cache across the link it crawls.
/*
--This returns 600 records but takes 12 minutes. It should take a few seconds top.
SELECT A.*, X.*
FROM
tblTable01AddOn AS A INNER JOIN Cache_test01..SQLUser.Table01 AS X ON A.ID = X.ID
--I also tried.
SELECT A.*, X.*
FROM Cache_test01..SQLUser.Table01 AS X, tblTable01AddOn A
Where X.ID = A.ID
*/
I have no access to the Cache server. I cannot make any modifications to any settings on that server. Our vendor reassured me that ID is indexed in Cache. ID is indexed on tblTable and Collation Compatible is checked on the SQL Linked Server pointing to Cache (Cache_test01).
I know little about Cache but I am stuck with making this work. At first glance I would imagine the performance issue has something to do with a setting on the Cache server. But I’m seeing the following which strongly leads me to believe that it is SQL.
I somewhat replicated this entire situation in MS Access and it is smoking fast. I created a second ODBC data source pointing to my SQL database. I then created an Access 2000 database and created two linked tables using the ODBC data sources (one to tblTable01AddOn in the SQL database and the other to Table01 in the cache database [using the same DSN I referenced when setting up the Linked Server in SQL]).I then put together this query:
/*
SELECT dbo_tblTable01AddOn.*, SQLUser_Table01.*
FROM dbo_tblTable01AddOn INNER JOIN SQLUser_Table01 ON dbo_tblTable01AddOn.ID = SQLUser_Table01.ID;
*/
It returns the data, all 600 records, in two seconds. So the providers are capable of working in this manner. When I take the SQL linked server out of the equation it is fast. The linked table in Access uses the same ODBC data source I used to create the linked server, so I don’t think it’s ODBC driver or the DSN either.
I should be able to see this performance in SQL. What is it that Access/Jet is doing that SQL isn’t? Can someone please help me workout the issue with my linked server? There is something about how the linked server is pulling the data that Jet is not doing. I have to get this to work or I’m going to fall weeks back on this project. With a new born in the house, our first, and working 60 hours a week at work, I can’t afford to loose that time.
Thank you for any help you can provide.
BTW, I also tried
/*
Select A.*, C.ID
From
tblTable01AddOn AS A,
(SELECT ID
FROM Cache_test01..SQLUser.Table01
WHERE ID IN (SELECT ID FROM tblTable01AddOn)) AS C
*/
Thinking I would drive this as a table and rejoin it to my table in SQL, but it crawled. SQL still pulled the entire table back and then looked for my data.
So why is MS Access Kicking my SQL Server 2000’s backside? ANY help would be IMMENSELY appreciated. Thank you in advance.
Steven