Forum Replies Created

Viewing 15 posts - 166 through 180 (of 244 total)

  • RE: optimising views

    Bet you a quid that it is...

    reet -But how you going to get rid of that Left join?

    It would certainly not be advisable...

  • RE: CASE Statement in Table Check constraint?

     

    Both can be transalated fairly strighforwardly into 'where not(ClaimStatusID = 2 and DateClosed is null)'

    --------------------------------------------------------------------------------------------------

    select

  • RE: CASE Statement in Table Check constraint?

    select

    'not(P and Q)' filter, * from @t where not(

  • RE: optimising views

    As well as following Johns advice you sould create an indexed view. See code below i have guessed some details about you data inparticulare the the columns to place the...

  • RE: return date only in stored procedure..help!

    ah yes didnt bother to test it. Nice use of data diff..

  • RE: Using TOP in the Select is slow

    try putting an order by clause in

  • RE: return date only in stored procedure..help!

    small adjustment to get rid of time portion..

     

    CREATE FUNCTION dbo.AddDays(@MyDate DATETIME, @Days INT)

    RETURNS DATETIME

         AS

      BEGIN

            RETURN cast(floor(cast(DATEADD(dd,@Days,DATEDIFF(dd,0,@MyDate))as float))as smalldatetime)

        END

  • RE: Brutal Query

    yep it works a treat. Just deleted 25 lines of dynamic sql and replaced it with your 5 lines

    thanks

     

  • RE: retrieving not null columns...

    I cant imagine that performance will ever be an issue with this kind of sp. Infact you shouldnt really build queries like this into prodution code at all. Anyway here...

  • RE: retrieving not null columns...

    See Stored Proc below

     

     

    --------------------------------------------------

    CREATE

    TABLE t1 (a int, b int, c...

  • RE: T-SQL

    there is likely to be way of getting the windows account you are loged onto the network under using T-SQL when you are logged into SQL as SA. Proiler seems...

  • RE: T-SQL

    can describe what you mean by user name please.

  • RE: T-SQL

    Yep but system_user will return windows authentication logins. If thats what you need??

  • RE: T-SQL

    well you could delimit the values

    declare @result varchar(100)

    select @result = cast(getdate() as varchar(20))+','+system_user

    print @result

    this wouldnt really be columns.

    Why you want to use print?

  • RE: T-SQL

    If you want columns you need to return a record set not a message and should therefore use select and not print.

    By original ID do you mean Login instead of...

Viewing 15 posts - 166 through 180 (of 244 total)