Forum Replies Created

Viewing 15 posts - 721 through 735 (of 897 total)

  • RE: Query Help

    You can make use of a Derived Table like below

    SELECTNetQty, NetPrice = NetQty * Rate

    FROM(

    SELECT NetQty = ( sellQty - BuyQty )

    FROM ...

  • RE: least date value

    This will give you the result you need, but i think the typing effort will be the same if not more because here there is a PARTITION BY clause which...

  • RE: least date value

    You can also use the ROW_NUMBER() function, but here again you will have a PARTITION BY clause which is similar to the GROUP BY Clause.

    If you need more detailed help,...

  • RE: Select 4th highest salary

    sachinrshetty (6/24/2010)


    Thank u Raunak. Perfect Answer 🙂

    You interviewer is not going to say the same to you as Thank you Sachin. Perfect Answer. Be prepared for more detailed questions on...

  • RE: Query Help

    This might help you

    ; WITH cte_TableName AS

    (

    SELECTROW_NUMBER() OVER( PARTITION BY index_code, code1, code2 ORDER BY startdate ) Row, *

    FROMTableName

    )

    SELECTT1.index_code, T1.code1, T1.code2, T1.startdate, DATEADD( DAY, -1, T2.startdate ) enddate

    FROMcte_TableName T1

    LEFT JOIN...

  • RE: sp

    I hope this is what you are looking for

    http://www.sqlservercentral.com/scripts/Script+Data/65998/

  • RE: Help With Coalesce

    Try this one

    DECLARE @Notes varchar(MAX)

    -- Here you are assigning a value to a variable

    SELECT @Notes = COALESCE(@Notes + ':', '') +

    CAST(Memo AS varchar(max))+'...

  • RE: Help in writing this query

    pattamuthu (6/16/2010)


    But when i add the year in where condition the results is not as expected.. i am searching for nothing where the year is 2010, when i add that...

  • RE: Help in writing this query

    You can do this using a LEFT OUTER JOIN

    SELECTA.*, 'True' Status

    FROM[Account] A

    LEFT OUTER JOIN[Transaction] T ON A.msisdn = T.msisdn

    WHERET.msisdn IS NULL

  • RE: Help With Coalesce

    Can you provide the query that gives you the error A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

    Probably you are doing...

  • RE: SELECT INTO

    sharath.chalamgari (6/14/2010)


    Nice Question on the Select Into

    for a second i thought Question as How many Rows then while selecting the answer i saw it as columns ...

  • RE: SELECT INTO

    I cant see any scalar value getting inserted or am i missing something

  • RE: DBCC CHECKIDENT

    Well, thats a bit of a problem. I have no idea of how to solve this. Hopefully somebody will come up with a solution soon.

    As for the problem in your...

  • RE: DBCC CHECKIDENT

    I am not sure but i think DBCC CHECKIDENT( 'TableName' ) always gives the same value for current column value and current identity value.

    It changes only when you reseed it...

  • RE: DBCC CHECKIDENT

    You could do it in this way then

    INSERTSomeTableName( TableName, IdentityValue )

    SELECTname, ident_current( name )

    FROMsys.objects

    WHEREOBJECTPROPERTY( OBJECT_ID( name ),'TableHasIdentity' ) = 1

    ANDTYPE = 'U'

Viewing 15 posts - 721 through 735 (of 897 total)