Options

What query did you write today

DatabaseHeadDatabaseHead Member Posts: 2,753 ■■■■■■■■■■
In the spirit of SQL I thought it would be a cool idea to create a thread that shows any new type of SQL you might want to share with the community. Anything you think would be helpful. I love writing SQL and love seeing what others have to write. How you get around tough situations etc.

Updated

Also post articles you may find interesting in the database space that ties to MS.

Comments

  • Options
    iBrokeITiBrokeIT Member Posts: 1,318 ■■■■■■■■■□
    ' or 1=1'--

    icon_lol.gif
    2019: GPEN | GCFE | GXPN | GICSP | CySA+ 
    2020: GCIP | GCIA 
    2021: GRID | GDSA | Pentest+ 
    2022: GMON | GDAT
    2023: GREM  | GSE | GCFA

    WGU BS IT-NA | SANS Grad Cert: PT&EH | SANS Grad Cert: ICS Security | SANS Grad Cert: Cyber Defense Ops SANS Grad Cert: Incident Response
  • Options
    cyberguyprcyberguypr Mod Posts: 6,928 Mod
    What in the world! I came here to post the same thing. LOL!!!!
  • Options
    DatabaseHeadDatabaseHead Member Posts: 2,753 ■■■■■■■■■■
    Well I guess I should follow up with something I like to use from time to time.

    I'm not really in "IT" I work with data exclusively. One thing I like to use when managing a catalog is between dates

    WHERE
    GETDATE() BETWEEN DATEADD(MONTH, -1, A.PRC_EFF) AND ISNULL(DATEADD(MONTH, -1, A.PRC_END), '9999-01-01')

    In this where I am looking back one month from when this script is executed. I have a JOB schedule to pull our catalog and **** into another table for ease of use, performance as well. The ISNULL is nice because it gives you the end date, since most end dates are null, this cast a value in there 9999-01-01 (Basically to the end of time).

    The reason I am using the job is to pivot out our price points since our table in interleaved
  • Options
    DatabaseHeadDatabaseHead Member Posts: 2,753 ■■■■■■■■■■
    Found this post in regards to master data management. Found this very insightful.

    https://msdn.microsoft.com/en-us/library/bb190163.aspx
Sign In or Register to comment.