Forum Replies Created

Viewing 15 posts - 2,056 through 2,070 (of 4,086 total)

  • RE: [Flat File Source [15]] Error: Data conversion failed. The data conversion for column returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".

    There's not much that you can do to fix bad data, especially if there is no apparent pattern to the bad data. You should go to the people who...

  • RE: SQL Query to fetch

    You're overcomplicating things. There is no reason to use windowed functions here. You want a simple aggregate.

    -- original code with windowed functions

    select catalog_name, CatalogCount, Last_update_time from

    (

    ...

  • RE: Help Eliminating Duplicate Data

    ChrisM@Work (12/28/2016)


    drew.allen (12/19/2016)


    Aggregate functions automatically exclude NULL values, so this can be simplified.

    SELECT *

    FROM (

    SELECT

    *,

    rn = ROW_NUMBER() OVER(PARTITION BY ProductId, ObjectId ORDER BY CheckNumber DESC)

    FROM EuroLuxProductBE.dbo.pdt_multidimensions m

    CROSS APPLY...

  • RE: Need help with SQL query

    Simon Hammill (12/27/2016)


    Hi Guys,

    Thanks for the replies, after a bit of playing about I finally got it to work as I needed. I used the below code.

    SELECT a.accomname, a.availno -...

  • RE: Trying to query the length of value for each column in a table

    wweraw25 (12/27/2016)


    Try this.

    DECLARE @TableName As varchar(500), @TableSchema As varchar(500)

    DECLARE @sql NVARCHAR(MAX)

    SET @TableName = 'Table_Name'

    SET @TableSchema = 'dbo'

    SELECT @sql = STUFF((SELECT

    '

    UNION ALL

    select ' + QUOTENAME(Table_Name,'''') + ' AS Table_Name,...

  • RE: Exclude the data starts with ING

    Chris.McCarty (12/27/2016)


    Hello,

    how to write a query - to exclude the field that starts with ING

    select * form table where ID NOT LIKE 'ING%' ?

    I want to exclude ING from all...

  • RE: Unique Indexes With Multiple Keys

    AZ Pete (12/23/2016)


    All,

    Two part question:

    1) Given a table with N columns (N1, N2, N3, N4, ... etc) and assume that column N1 is a clustered PK and column N2 has...

  • RE: TSQL query help needed

    If the two tables are exactly the same, couldn't you just drop the empty table and rename the remaining table? Of course, that wouldn't get rid of your duplicates.

    Another...

  • RE: Overlapping datetime ranges.

    ben.brugman (12/23/2016)


    Did take a better look at the code. I am not familiar with the "BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING" part.

    But I do think I do understand the code....

  • RE: Need help with SQL query

    Thom A (12/26/2016)


    Firstly a brief explanation of how AND and OR statements work. I noticed that you have a mixture of AND and OR without any brackets, which is likely...

  • RE: Performance issue with xquery

    In my very small scale tests, it appears that using the XML count function is much slower than using the SQL count function. Try the following:

    NumberOfDeleiveries ...

  • RE: Get unique data

    This seems to perform faster.

    SELECT t.Value

    FROM @Test t

    GROUP BY t.Value

    ORDER BY MIN(t.Id)

    Drew

  • RE: Today's Random Word!

    Revenant (12/22/2016)


    Manic Star (12/22/2016)


    Grumpy DBA (12/22/2016)


    Ed Wagner (12/22/2016)


    Fried

    Brain

    Fart

    Wind

    Talkers

  • RE: Get unique data

    KGJ-Dev (12/22/2016)


    Hi,

    Below the sample data

    select 'verify1' union all

    select 'verify1' union all

    select 'verify1' union all

    select 'chance1' union all

    select 'chance1' union all

    select 'chance2' union all

    select 'chance2'

    I need to get...

  • RE: Compare subset with subset in same table

    This approach will work, but it may not be the most efficient. It uses XML concatenation to create a comma-separated list of the ingredients and then checks for two...

Viewing 15 posts - 2,056 through 2,070 (of 4,086 total)