Forum Replies Created

Viewing 15 posts - 61 through 75 (of 86 total)

  • RE: Stored procedure return value

    Based on the logic, yes, the procedure exited prior to attempting the update.

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Stored procedure return value

    Roland Alexander STL (10/5/2012)


    The RETURN function can return a value to the caller, but it is up to the caller to capture and process the value:

    EXEC @return = dbo.my_procedure;

    In this...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Stored procedure return value

    The RETURN function can return a value to the caller, but it is up to the caller to capture and process the value:

    EXEC @return = dbo.my_procedure;

    In this case, (2) is...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: trying to change date to use next month

    If what you are trying to do is get the first day of the following month try this:

    DATEADD(month, DATEDIFF(month, 0, getdate()) + 1, '');

    Also, you should know that SQL Server...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: TSQL Case Statement help

    You're getting an error because the CASE statement needs to be enclosed in parentheses.

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: how to avoid duplicate business logic

    norbert.manyi (10/2/2012)


    Take the following example:

    select * from tbl_Users U where U.active = 1 and U.deleted = 0

    It seems that the application owner keeps changing the business logic, so I would...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: SQL Server + Mgngmt Studio Express on the top on VS2010 Pro

    Just as an FYI - anything that can be done from Management Studio can be done from VS, provided you have the Ultimate or Database Edition (you didn't mention your...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Get the most recent row - how to

    An alternate:

    create table #tmp (status_id int, status_code char(1), status_sequence int);

    insert into #tmp

    values

    (1, 'A', 1),

    (1, 'B', 3),

    (2, 'B', 1),

    (3, 'C', 1),

    (3, 'A', 2);

    select

    status_id,

    status_code

    from

    #tmp t1

    where

    status_sequence = (select max(status_sequence) from #tmp t2 where...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Difference between decimal and smallmoney

    Then the short answer is, use the variable with the smallest footprint that meets your requirements: in this case, smallmoney.

    As to the one-byte difference, I can't say definitively as I...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Difference between decimal and smallmoney

    So...what's your question?

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: user_seeks Vs user_scan

    User seeks and scans are those initiated by stored procedures or ad hoc queries issued by users (such as you), as opposed to those initiated by the system.

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Variable for the datepart in DATEADD Function

    Excellent!

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: Variable for the datepart in DATEADD Function

    According to BOL, datepart Is the part of date to which an integer number is added. The following table lists all valid datepart arguments. User-defined variable equivalents are not valid.

    User-defined...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: OPTIMIZE FOR UNKNOWN (parameter sniffing problem)

    GilaMonster (9/21/2012)


    Just asking if you wanted to think about that some more... 😉

    Which is a nice way of saying I may be typing faster than I'm thinking 😉

    The thought I...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

  • RE: OPTIMIZE FOR UNKNOWN (parameter sniffing problem)

    GilaMonster (9/21/2012)


    Roland Alexander STL (9/21/2012)


    Which is the point of using local variables, since it will force a new plan each time the query is run.

    Errr... really?

    Oh, now, was that...

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer

Viewing 15 posts - 61 through 75 (of 86 total)