Viewing 15 posts - 4,846 through 4,860 (of 7,610 total)
Jeff Moden (8/28/2015)
ScottPletcher (8/28/2015)
Yes, much care needs to be taken before allowing anyone to run...
August 28, 2015 at 12:43 pm
IF OBJECT_ID('tempdb.dbo.#db_sizes') IS NOT NULL
DROP TABLE #db_sizes
CREATE TABLE #db_sizes (
db_name varchar(100) NOT NULL,
data_size_kb bigint NULL,
...
August 28, 2015 at 10:49 am
DECLARE @sqlVersion smallint;
DECLARE @UserName nvarchar(100);
SELECT @sqlVersion = LEFT(ProductVersion, CHARINDEX('.', ProductVersion) - 1)
FROM (
SELECT CAST(SERVERPROPERTY('ProductVersion') AS varchar(30)) AS ProductVersion
) AS system_value
--get all user/login names that need removed...
August 28, 2015 at 10:27 am
Look at the query plan, and see if it is scanning the clustered index or doing keyed lookups by joining to a table of constants. If it's a scan,...
August 28, 2015 at 10:06 am
Maybe you could create a dummy user in the db, have the main user EXECUTE AS that user to give him/herself permission, then REVERT back to their own id for...
August 28, 2015 at 10:03 am
Ed Wagner (8/28/2015)
August 28, 2015 at 9:53 am
The point is to run a business, not have a perfect environment for the db itself.
Yes, much care needs to be taken before allowing anyone to run ad-hoc queries. ...
August 28, 2015 at 8:57 am
Lowell (8/28/2015)
August 28, 2015 at 8:53 am
aleksandra 81219 (8/28/2015)
I put some PRINT commands, look at this
WeeksOnStart
20150406,20150401
val_in_cursor
2015-04-06
Warning: Null value is eliminated by...
August 28, 2015 at 7:46 am
Yes, if I had done the synonym names in the correct order :-D. I think I got them backwards in the script:
Edit: That is, after you run this code:
CREATE...
August 27, 2015 at 2:28 pm
Nah, I was thinking of something like this to generate the commands to run. If you want, you could even actually run the code instead of just generating it.
DECLARE...
August 27, 2015 at 1:52 pm
To me it seems fairly easy to match single rows. Maybe you can just output those matches to a table and then consolidate the like ids using that result.
SELECT...
August 27, 2015 at 1:41 pm
Since you literally can't add enough values here to make a cursor all that bad, you might want to use a cursor just to have better control over the processing...
August 27, 2015 at 1:30 pm
DECLARE @database_name NVARCHAR(50)
SELECT @database_name=DB_NAME()
WHILE 1 = 1
BEGIN
IF EXISTS(
SELECT 1
FROM msdb.dbo.backupmediafamily
INNER JOIN msdb.dbo.backupset ON...
August 27, 2015 at 1:11 pm
No, you'd need to use a synonym for each object. But it's easy enough to generate the code to create the synonyms for all tables in the current db.
August 27, 2015 at 1:04 pm
Viewing 15 posts - 4,846 through 4,860 (of 7,610 total)