Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

rimazuc

@rimazuc
About
Posts
4
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can a SQL login have more than one user
    R rimazuc

    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).

    Database database sysadmin

  • Deleting Data Using Job Scheduler
    R rimazuc

    The 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....
    GO

    Cheers

    Database database question career

  • if - else statement in sql
    R rimazuc

    Another 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

    Database database sql-server help

  • if - else statement in sql
    R rimazuc

    Hi 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

    Database database sql-server help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups