Forum Replies Created

Viewing 15 posts - 916 through 930 (of 1,114 total)

  • RE: Isnull function

    As you told if we want to display -1 or some other negative values,

    we need to write,

    select * from sometable where column > 0

    select * from sometable where column...

  • RE: Isnull function

    Yes I got it.But,

    A Little late here,As per SQL-92 standard,if ANSI_NULLS option is on, will return FALSE only.

    So before executing this code

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

    DECLARE @Var1 INT

    SET @Var1 = NULL

    SELECT

    CASE WHEN @Var1...

  • RE: Isnull function

    Jeff,

    SELECT * FROM sometable WHERE ISNULL(Column2, 0) <> 0

    SELECT * FROM sometable WHERE Column2 IS NOT NULL AND Column2 <>...

  • RE: Isnull function

    A Little late here,As per SQL-92 standard,if ANSI_NULLS option is on, will return FALSE only.

    So before executing this code

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

    DECLARE @Var1 INT

    SET @Var1 = NULL

    SELECT

    CASE WHEN @Var1 =...

  • RE: Finding Current Month's First Day& Last Day

    Also,Dateadd(month,0,0)

    Here,

    1st - Zero stands for Number to be added to the month part.

    2nd -Zero Stands for 1900-01-01(Default Datetime).

    It will show 1900-01-01.

    Dateadd(month,0,-1)

    Here,

    1st - Zero stands for Number to be added to...

  • RE: Finding Current Month's First Day& Last Day

    Michael,

    select FirstOfThisMonth =dateadd(month,datediff(month,0,getdate()),0),LastOfThisMonth =dateadd(month,datediff(month,-1,getdate()),-1),FirstOfLastMonth =dateadd(month,datediff(month,0,getdate())-1,0),LastOfLastMonth =dateadd(month,datediff(month,-1,getdate())-1,-1)

    Thanks.only the first two was worked.

    I have made some changes in the last 2 statements.

    FirstOfLastMonth =dateadd(month,datediff(month,0,dateadd(mm,-1,getdate())),0),

    LastOfLastMonth =dateadd(month,datediff(month,-1,dateadd(mm,-1,getdate()),-1)

    It gave last month's firstdate & lastdate.

  • RE: Find Number of Character Repeated

    I am going to try it and get back to you.

  • RE: Palindrome-SQL

    @length/2.0 + 1

    I am not able to understand the above statement.Why are you dividing it by 2 and add with 1.

  • RE: Find Number of Character Repeated

    Can you tell me where exactly you can apply spt_values table?

    I mean In which situations you go to spt_values.can you list out some examples ?

    Also, say for example if...

  • RE: Find Number of Character Repeated

    I don't have the permission to create function.Can you give me the solution without function ?

  • RE: Palindrome-SQL

    John,

    Can you explain me the logic ?

  • RE: Palindrome-SQL

    We can use REVERSE() Function.I agreed.

    But my friend faced the above question in his recent interview.Interviewer asked him not to use REVERSE() Function.But he failed to answer. Thats why i...

  • RE: How to avoid While Loop - RBAR ?

    Madhivanan,

    Thanks.Suppose if i have like this,

    Declare @Str varchar(300)

    @Str = 'Karthikeyan,Madhivanan,JeffModen,Steve-Jhones,MattMiller,GilaMonster'

    do we have to repeat your code for 6 times? Suppose if i have around 20 names do we repeat the...

  • RE: Palindrome-SQL

    I dont want to use REVERSE() Function. I need pure sql code logic which could check whether it is palindrome or not.

  • RE: How to avoid While Loop - RBAR ?

    @str length is varchar(50) only.

Viewing 15 posts - 916 through 930 (of 1,114 total)