Friday, August 26, 2011

Querying agent job status, executing and waiting for job completion from within T-SQL

Querying agent job status, executing and waiting for job completion from within T-SQL

Wednesday, August 03, 2011

minimum account permissions for service broker

USE USERDB
go

CREATE SCHEMA [office\user] AUTHORIZATION [office\user];

GO
CREATE USER [office\user] WITH DEFAULT_SCHEMA = [office\user];
GRANT CREATE PROCEDURE TO [office\user];
GRANT CREATE QUEUE TO [office\user];
GRANT CREATE SERVICE TO [office\user];
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [office\user];
GRANT REFERENCES ON CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] TO [office\user];
GRANT RECEIVE ON QueryNotificationErrorsQueue TO [office\user];
GRANT CONTROL ON SCHEMA::[dbo] TO [office\user];
GRANT IMPERSONATE ON USER::DBO TO [office\user];
GO

Monday, June 27, 2011

Parse string characters and separate them

DECLARE @String NVARCHAR(99) = N'abcdefghijk' ;

;WITH Numbers
AS ( SELECT 1 AS Number
UNION ALL
SELECT Number + 1
FROM Numbers
WHERE Number < 99
)
SELECT SUBSTRING(@String, Number, 1) AS SingleChar
FROM Numbers
WHERE Number <= LEN(@String) ;