Forum Replies Created

Viewing 15 posts - 1,516 through 1,530 (of 2,007 total)

  • RE: Removing one letter from a string

    Yet another way: -

    DECLARE @TABLE AS TABLE (col VARCHAR(100))

    INSERT INTO @TABLE

    SELECT 'Rice FarmingT'

    UNION ALL SELECT 'Fruit and Tree Nut FarmingT'

    UNION ALL SELECT 'Tree' --Non-modified row

    UNION ALL SELECT 'Fruit' --Non-modified row...

  • RE: problem using ISDATE in a Function

    RichardBo (9/22/2011)


    I accept that the function boils down to a CONVERT, but the problem is really about validating the string passed before calling CONVERT.

    Eg

    DECLARE @val CHAR(19)

    SET @val='08/31/2011 14:34:56'...

  • RE: Joining, but need to find the row with the min values in it

    greg.bull (9/22/2011)


    Hi,

    I am LEFT joining to a lookup table by product code to find a product cost. The problem is that in the lookup table there are multiple rows for...

  • RE: How to display Column Names v/s Column Values

    Good afternoon!

    It seems that your DDL script, which I'm sure you provided after visiting SSC more than 200 times, has somehow become detached and in its place is a...

  • RE: differences between 2 tables

    MuraliKrishnan1980 (9/20/2011)


    We need not use Left Join as we are looking for records only for the account which is present in table A. So we should use Inner Join to...

  • RE: Using 'XYZ' where ever null data is existing in the column

    SELECT CASE WHEN firstname IS NULL

    THEN 'xyz'

    ...

  • RE: differences between 2 tables

    Firstly, this is the correct way to post sample data: -

    DECLARE @TABLEA AS TABLE (account CHAR(8), HCS_Code CHAR(4))

    DECLARE @TABLEB AS TABLE (account CHAR(8), HCS_Code CHAR(4))

    INSERT INTO @TABLEA

    SELECT 'AC_1234', 'ICP1'

    UNION ALL...

  • RE: To get month Names between two dates

    nhimabindhu (9/20/2011)


    option (maxrecursion 0)

    now Recursssion error wont occur if i write this code in that program

    Yes, but it's still over 2x slower than the tally table solution I suggested.

    StartDate '1901-01-01',...

  • RE: To get month Names between two dates

    nhimabindhu (9/20/2011)


    DECLARE @SDATE DATETIME

    DECLARE @EDATE DATETIME

    DECLARE @MLIST TABLE

    (MName VARCHAR(30))

    SET @SDATE = '2000-09-20'

    SET @EDATE = GETDATE()

    WHILE (@SDATE < @EDATE)

    BEGIN

    INSERT INTO @MLIST

    SELECT...

  • RE: To get month Names between two dates

    nhimabindhu (9/20/2011)


    Thanks fr reply

    declare @date1 datetime

    declare @date2 datetime

    set @date1=GETDATE()

    set @date2='2011-12-25'

    ;with cte as (

    select datename(month,@date1) as [Month_Name],@date1 as dat

    union all

    select datename(month,DateAdd(Month,1,dat)),DateAdd(Month,1,dat) from cte

    where DateAdd(Month,1,dat) < @date2)

    select [Month_Name]...

  • RE: To get month Names between two dates

    Homework question?

    How's this?

    DECLARE @startdate DATE = '2011-09-20', @endate DATE = '2011-12-21'

    SELECT a.months

    FROM (VALUES(1,'January'),(2,'February'),(3,'March'),(4,'April'),(5,'May'),(6,'June'),(7,'July'),

    (8,'August'),(9,'September'),(10,'October'),(11,'November'),(12,'December')) a(number,months)

    WHERE a.number >= DATEPART(month,@startdate) AND a.number <= DATEPART(month,@endate)

  • RE: Mathematical Theory (controversy!)

    rmechaber (9/16/2011)


    jcrawf02 (9/16/2011)


    rmechaber (9/16/2011)


    It's good that you "have a problem with this", b/c if you try doing it with a computer, you will have problems! The computer only approximates...

  • RE: I need to improve this query I have attached here

    ranask_47 (9/16/2011)


    This is a query for one of our Hospital client needs to submit Clinical measure report required by CDC. I have attached a word document which describes the Criteria...

  • RE: I need to improve this query I have attached here

    Please read this article[/url], to find out how you should be posting your query and about sample data which is required for us to help.

    Obviously obfuscate your data in some...

  • RE: Proper Case

    Sudhir Dwivedi (9/16/2011)


    huh!!!!

    DECLARE @str VARCHAR(255) =' rajneeh

    kumar

    is

    working in technext'

    SET @str = ' ' + @str

    SET @str = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@str, ' a', ' A'), ' b', ' B'), '...

Viewing 15 posts - 1,516 through 1,530 (of 2,007 total)