Forum Replies Created

Viewing 15 posts - 4,081 through 4,095 (of 5,502 total)

  • RE: Using SUM and selecting nulls from filter

    You could join it to either a solid calendar table or buid one on the fly and do a left join on it.

    Something like

    ;WITH

    calendar_yr AS

    (

    SELECT 2009 AS yr UNION...

  • RE: Does adding additional files to the TempDB require downtime?

    Please don't cross post.

    Discussion already started here

  • RE: date question

    adams.squared (3/4/2010)


    For the last 13 months, I would use

    where datediff(mm, OrderDate, getdate())<=13

    edit: Mine will include the whole month, so for today it would have 13 months and 4 days...

  • RE: Preventing data modification depending on other data state

    Would it be possible to use views that will exclude the rows/columns they're not allowed to change and grant update permission to that view?

    That still would prevent accessing your main...

  • RE: date question

    SELECT col

    FROM table

    WHERE orderdate >= DATEADD(month,-13,getdate())

    AND orderdate < getdate ()

    or, if you'd need to include the full month:

    SELECT col

    FROM table

    WHERE orderdate >= DATEADD(month,DATEDIFF(month,0,getdate())-13,0)

    AND orderdate < getdate ()

  • RE: Preventing data modification depending on other data state

    What is the best way to check and prevent updates when done by outside tools like these ?

    If you want to prevent updates done other than via your stored procedure...

  • RE: Subquery in case statement

    rockingadmin (3/4/2010)


    hello lmu92,

    i have wasted lot of time and struggled for this logic. finally i got the solution which was same as you said. but i didn't mention...

  • RE: Subquery in case statement

    I'm not sure if this would give you the same result since there are no data available to test again...

    SELECT

    CASE

    WHEN b.userid IS NOT NULL AND b.appId=1 AND CHARINDEX('%',a.permissionval)=1...

  • RE: code to change the values generated by int identity

    Did you have a look at this article[/url] posted just the other day on this site?

  • RE: trying to return data with only the latest date

    Please provide some sample data to play with.

    The best way to post sample data is described in the first link in my signature.

  • RE: Column Data type issue

    Thamizh (3/3/2010)


    Dear SSC,

    I have a Decimal column.I'm not authorized to change the column data type.My data will be positive or negative value.What i need is, if the value will...

  • RE: Create view issue

    Well, since we just figured that the code is actually working, change the print statement to EXEC(@SQL).

    Post the error message (if there is one...).

    Again, it's running just fine on my...

  • RE: Create view issue

    Ok,

    now change the value of @DESDB to your target db (or tempdb, if you want).

    Run the script again. Copy the result into a new query windo and run it. Post...

  • RE: Create view issue

    Please run the following code and post the first 8 (eight) lines of code.

    It will only print the SQL statement, not execute it. I added USE MASTER to protect your...

  • RE: Querying a Table Using Dynamic SQL

    Glad it worked out for you 😀

    Once you figured how ROW_NUBER and its sibling (RANK and DENSE_RANK) work, all come in really handy. 😉

Viewing 15 posts - 4,081 through 4,095 (of 5,502 total)