Tag Info

Hot answers tagged

6

As things stand, the query: DELETE TOP (4000) FROM [OLD_TABLE] WITH (TABLOCKX) WHERE [Date] < '2014-01-01 00:00:00' ...has to scan the whole heap table, testing each row it finds, until it eventually finds 4000 to delete. On the next iteration, the whole business starts again from square one. Assuming the scanning process is performed in the same ...


5

I did not find correct answer posted so I will try to explain you in details, bear with me. First whenever you post question please post version and edition of SQL Server you wont believe answer might change completely with different versions Lately we've noticed the VM Committed memory space for our SQL Server 2005 instance grows and it's almost at the ...


5

When the script is generated in Profiler 2005, the default value saved for the logical operator is 1='OR', so the trace will capture more information than we initially intended. exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME1' -- OR exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME2' exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME3' ...


4

The SELECT ... INTO syntax is only for new tables. I think you want: INSERT dbo.TableB ( <column list> ) SELECT <column list> FROM dbo.TableA WHERE ID IN ( SELECT ID FROM dbo.TableC ) ;


3

You could use bcp to write the rows you wish to retain to a different server. Then truncate the table (or drop and re-create). Use bcp a second time to import the data previously exported.


1

SQL Server will reuse available space in the datafile as necessary. If there is no space left it will attempt to auto-grow the datafile(s) for that File Group based on the auto-growth setting. If auto-grow is disabled and there is no room left, then you will get an error trying to do something that would require more space. With regards to deleting large ...


1

The easiest way I know of is creating a table in tempdb with a single column (id for instance), then expand the tempdb node in SSMS and find the table. Right click and select "Edit top 200 rows". A grid will appear. Select the whole first row with the row header on the left, then paste the whole contents of the file. BCP is an alternative way to load the ...


1

Start by checking max memory. Instructions here: http://technet.microsoft.com/en-us/library/ms191144(v=sql.90).aspx You should set the max to be low enough to leave space for the os and any other apps. Which in your case is going to be very low. Maybe 500mb-1gb


1

If it was possible to connect to a SQL Server without setting up a security context on that server, that would be a serious security hole. So, there must be a security context. If you can ride on some existing rights that are already defined, then fine, but likely any existing security context was not tailored for your need. And since you want a specific ...


1

There are three ways to find who is connected to a database in sqlserver. First one: Use the SQL SERVER Management Studio -- Management -- Activity Monitor This gives a list of users, database names, status, command, transactions, application with which they are using the database, CPU, IO and Memory usage, Login time etc. Second One: Use the built in ...



Only top voted, non community-wiki answers of a minimum length are eligible