yes an SQL login can be mapped to more than one DB user. Picture an SQL login as an access to a building while a DB user provides specific access to rooms in the building. No access to the building (Login) then no access to the rooms (DB user).
rimazuc
Posts
-
Can a SQL login have more than one user -
Deleting Data Using Job SchedulerThe script below should help. Just modify what is required. Job step as you already know will be T-SQL
DECLARE @DaysPassed INT -- Number of days required for record deletion
SELECT @DaysPassed = DATEDIFF(DD,GETDATE() - 5, GETDATE()) -- Diff in days eg (GETDATE() - 5, GETDATE() = today - (today - 5)
IF @DaysPassed = 5 -- If days paseed = 5 then...
BEGIN
SELECT GETDATE() -- Your delete statement can go here.
END
ELSE
PRINT 'I love Code project' -- If not equal to 5 then....
GOCheers
-
if - else statement in sqlAnother method is to use a variable to hold the number of records and based on the number of records, decide which sql statement to execute. For example --PUR ROW COUNT IN A VARIABLE DECLARE @rowcount INT SELECT @rowcount = COUNT(*) FROM tablename IF @rowcount >= 27 --SPECIFY the number expected BEGIN PRINT 'TEST-1' --OR SELECT STATEMENT END ELSE BEGIN PRINT 'TEST-2' -- OR SELECT STATEMENT END hope this helps. Cheers
-
if - else statement in sqlHi There You can do a rowcount and if a count on the no of rows is zero, then Select ..... For example IF EXISTS (SELECT COUNT(*) FROM tablename) BEGIN SELECT ..... FROM TABLENAME END -- if no data then do... that is if row count is zero ELSE SELECT ..... FROM TABLENAME