Forum Replies Created

Viewing 15 posts - 16 through 30 (of 51 total)

  • RE: Find occurence of any value in database!

    Does this stored proc really give the occurence of a value in the database or the occurence of a attribute/field name in the database ?

    I have a value and I...

  • RE: How to convert INTEGER to TIME

    declare @time int

    set @time = 70

    select cast((@time / 60) as varchar(2)) + ':' + cast((@time % 60) as varchar(2))

  • RE: Stored rocedure - check resultset before returning null

    Here's a way..

    create table names1(id int not null identity(1,1),empname varchar(10))

    create table names2(id int not null identity(1,1),empname varchar(10))

    create table names3(id int not null identity(1,1),empname varchar(10))

    --Insert values...

    select coalesce((select empname from names1 where...

  • RE: A fun SQL bug

    UPDATE #tblTesting

    SET TestStr = CASE

    WHEN...

  • RE: Checking for last day of the month?

    andrewd.smith (2/12/2009)


    SELECT FirstOfMonth = DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0),

    LastOfMonth = DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, -1)

    A nice and simple way 🙂

    Here's another way I used to use:

    select dateadd(day,-1,dateadd(month,1,str(year(getdate()),4)+'-'+str(month(getdate()),2)+'-01'))

  • RE: using datetime variable - performance hit?

    gyessql (2/10/2009)


    I figured probably since I dropped and recreated the procedure the plan might have been changed. Am I correct?

    However, I created another proc for this particular query and am...

  • RE: case statements to insert/update

    Is MERGE supported in Sql Server 2005?

  • RE: case statements to insert/update

    Can I use dynamic sqls. Will there be a performance difference if I have more dynamic sqls in my stored proc?

  • RE: using datetime variable - performance hit?

    Gail, Noel - Thanks for all the suggestions.

    Today morning I dropped the procedure with this query and recreated it without making any change. It ran very fast. I ran it...

  • RE: Date Function Best Alternative

    Another option would be to use:

    last_update > cast(convert(char(10),getdate()-1,101) as datetime)

    and

    last_update < cast(convert(char(10),getdate(),101) as datetime)

    I'm not sure about the performance difference in these 2 methods

  • RE: using datetime variable - performance hit?

    GilaMonster (2/9/2009)


    Parameter sniffing, or more accurately the lack of parameter sniffing. SQL doesn't know the values of the variables at compile time and hence guesses the rows affected. If it...

  • RE: using datetime variable - performance hit?

    Thanks Lynn. I won't be able to post the execution plan, I am not allowed to post official work in public forums. Hope u understand.

    Could u hint something for...

  • RE: case statements to insert/update

    Thanks. I wanted to confirm if CASE can be used for such a thing. It would make things easier 🙂

  • RE: On Using JOINS in FROM clause

    GilaMonster (1/22/2009)


    Yes. One of them will run and one of them will give you a syntax error.

    :D:D Good one!!

    Thanks for all the clarifications..

  • RE: On Using JOINS in FROM clause

    Thanks Gail..

    GilaMonster (1/22/2009)


    Yup, that's a join based on two columns. ...

    Is there any difference between joining in these 2 ways?

    select ...

    from table t1

    ...

Viewing 15 posts - 16 through 30 (of 51 total)