Forum Replies Created

Viewing 15 posts - 2,731 through 2,745 (of 10,144 total)

  • RE: query to return rows with c2=c3

    ;WITH Primaries AS (

    SELECT *

    FROM #Test

    WHERE id = 3

    )

    SELECT *

    FROM Primaries

    UNION ALL

    SELECT t.*

    FROM #Test t INNER JOIN Primaries p ON p.c1 = t.c2

  • RE: How to Optimize this SQL query of finding Duplicates for Better Database performance

    muralikrishna2489 (1/8/2015)


    Hi Laxmi,

    Thanks for the suggestion.

    I am not inserting anything into the table, I just need to Find the count of duplicates. Please tell why I need to use insert...

  • RE: Correlated Subquery?

    SQLSACT (1/9/2015)


    Thanks

    Is it the same as:

    select p.sku

    ,p.product_description

    ,pp.plant_nbr

    from dbo.Products p

    where exists (select...

  • RE: Dynamic Query

    Comment out EXEC(@sql) and add an extra statement: PRINT @sql. Printing the statement and running the generated sql catches most errors.

    Your final SELECT from the CTE:

    Select ARNOTES.AR_NUMBER,HD_DATE_TIMEX,ARNOTES.TRANS_NO,ARNOTES.MESSAGE_COUNTER,ARNOTES.MESSAGE_2,ARNOTES.SQL_LAST_UPDATE from ARNOTES where...

  • RE: Converting Char string to dateTime issue

    Jeff Moden (1/6/2015)


    You don't need to do anything to it but convert it to a DATETIME. And, you don't need to insert any spaces. SQL Server is pretty...

  • RE: Sql View to display code descriptions

    Minnu (1/6/2015)


    Hi Team,

    If there any possiblity to replace below char's in code column with string in another table.

    id | codes

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

    001 | a,b,c

    002 | e,g,t

    003 | r,t,y,e

    without using split function.

    Yes...

  • RE: Converting Char string to dateTime issue

    gabCruz (1/6/2015)


    I am developing a stored proc that retrieves from a table with a varchar(50) column named "JoiningDate". The values are of this format "DDMONYY". Sample values are "06JAN15", "04MAR14",...

  • RE: How to convert uniqueidentifier from string to use in a join / where clause

    Say you have a binary value 10 (decimal 2), and you want to convert it to decimal 10 for display or whatever. Just about any conversion will yield 2.

    Varbinary to...

  • RE: How to convert uniqueidentifier from string to use in a join / where clause

    Hi Dennis, I had a similar frustrating struggle a couple of weeks ago, tying up trace data with jobs. This is what I came up with, more or less:

    -- Agent...

  • RE: Query

    Junglee_George (1/6/2015)


    Yes Chris, You are correct. I want to get last position from StoringEvents Table.

    Thanks. Can you follow Koen's advice and post scripts please? Also, can you provide us with...

  • RE: Conditional Case in WHERE

    SELECT *

    FROM #parent p

    LEFT OUTER JOIN #child c

    ON c.CID = p.PID AND (@search = '' OR c.ChildName LIKE '%' + @search + '%')

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

    SELECT *

    FROM #parent p

    LEFT OUTER...

  • RE: Query

    Junglee_George (1/6/2015)


    I have a query like :

    SELECT DISTINCT C1.containerCode ,C1.containerName,

    (SELECT C1.containerCode as containerCode,SE.createdOn

    FROM Containers C1

    LEFT JOIN StoringsEvents SE ON C1.containerIncId = SE.ITEMINCID

    AND C1.containerSqlId = SE.ITEMSQLID

    AND SE.isDeleted = 0

    LEFT JOIN CONTAINERS...

  • RE: Weird Problem

    Match the datatype of your parameters

    @ExtnNo varchar,

    @EmpName varchar,

    @FromDate varchar,

    @ToDate varchar

    to the datatype of the column they are to be compared with. Implicit datatype conversions can yield unexpected results.

  • RE: Are the posted questions getting worse?

    spaghettidba (1/1/2015)


    Happy New Year everybody!

    And there's a very special thank you message for every single one of you on my blog here! 🙂

    Thank you for involving me in the most...

  • RE: Are the posted questions getting worse?

    Stefan Krzywicki (1/2/2015)


    Happy New Year everyone!

    Who, like me, is at work today?

    Yep, working with the biggest and nastiest financial spreadsheet spaghetti nightmare you could possibly imagine. Only the lingering taste...

Viewing 15 posts - 2,731 through 2,745 (of 10,144 total)