Forum Replies Created

Viewing 15 posts - 736 through 750 (of 897 total)

  • RE: DBCC CHECKIDENT

    If you want to insert the IDENTITY value of a table into another table, there are other ways you can do it. One such way would be to use the...

  • RE: How many Records Will Get Selected

    CirquedeSQLeil (6/10/2010)


    I don't see this as a trick question. I see it as a good question. There is something to be learned from this question and thus it...

  • RE: How many Records Will Get Selected

    Another Trick Question that is sure to generate quite a bit of debate. You dont learn anything new, and lose 3 points. I am sure many would be knowing the...

  • RE: Invalid length parameter passed to the SUBSTRING function

    See if this query returns any negative value in the result set

    ;WITH CTE AS

    (

    SELECT Field9,

    RowID,

    ...

  • RE: Employee job mapping

    Try this

    Create Table Job (JobID int identity, Role char(10), Location char(50))

    Create Table Employee (EmpID int identity, EmpName char(50), Role char(10), Location char(50), JobID int)

    Insert into Job (Role, Location) Values ('SE',...

  • RE: Employee job mapping

    Please post the table structure, sample data and the desired output in a readily consumable format. I am sure you will get help immediately. Your explanation and example is quite...

  • RE: Add 2 columns in one sql statement

    Change it like this

    ALTER TABLE Transactionlog

    ADD businessunit_id NUMERIC(10,0), businessunit_name VARCHAR(250)

  • RE: Set based approach to get previous rows value for same column which is a calculation

    Add the MAXRECURSION option

    SELECT thedate, val1, calc

    FROM cte_final_data

    OPTION ( MAXRECURSION 0 )

    This will work for larger datasets( 0 stands for infinite here ). But yes,...

  • RE: Set based approach to get previous rows value for same column which is a calculation

    You can do this using CTE

    ; WITH cte_data AS

    (

    SELECTROW_NUMBER() OVER ( ORDER BY thedate ) Row, *

    FROM@data

    ), cte_final_data AS

    (

    SELECTRow, thedate, val1, 0 calc

    FROMcte_data

    WHERERow = 1

    UNION ALL

    SELECTdata.Row, data.thedate, data.val1,...

  • RE: Jst a query......

    Maddy...! (5/27/2010)


    Mr. Moden

    I gave that statement bcoz Dave gave me some blog link to verify so i asked him and told him if you can...

  • RE: Need assistance in LIKE

    Change it to

    select Exam, substring(Exam,1,3),sk.level1name

    from EmployeeInfo ed

    left outer join Skills sk

    on ed.Exam = sk.level1name

    where empid = 161522

    and sk.level1name like @ucf + '%'

  • RE: select query issue

    A LEFT OUTER JOIN with the same table again will give you the desired result

    SELECTEmp.Emp_Name, Sup.Emp_Name Sup_Name

    FROMEmployee Emp

    LEFT OUTER JOINEmployee Sup ONEmp.Supervisor_ID = Sup.Emp_ID

  • RE: Problem with DATE

    Remove the DAY function like this

    SELECTContainer_Id, End_Journey_Date

    FROMdbo.Container

    WHEREDATEDIFF( DAY, '1/29/2009 12:00:00 AM', End_Journey_Date ) <= 5

  • RE: Time interval split

    Its still not very clear. Can you provide the expected result. That would certainly help people help you. And if you provide it in a ready to use format as...

  • RE: Time interval split

    You can also use a Tally Table for the same. Once you create a Tally table you can use the script given below to get the desired results.

    DECLARE@sdtStartTimeSMALLDATETIME

    DECLARE@sdtEndTimeSMALLDATETIME

    DECLARE@iSlotsINT

    SET@sdtStartTime = '26-May-2010'

    SET@sdtEndTime...

Viewing 15 posts - 736 through 750 (of 897 total)