Forum Replies Created

Viewing 15 posts - 2,746 through 2,760 (of 4,087 total)

  • RE: Convert a string with an array of variables?

    Sergiy (3/31/2016)


    drew.allen (3/31/2016)


    It's actually MUCH faster to create a table using the VALUES expression, because most of the cost is writing and reading the temp table to tempdb. If...

  • RE: Bulk load error File Could Not Be Opened

    I recommend ALWAYS using UNC paths.

    Drew

  • RE: Convert a string with an array of variables?

    Sergiy (3/30/2016)


    Solution is suprisingly simple.

    1. Create a "translation" table:

    CREATE TABLE #Mapping (

    FromChar NCHAR(1) PRIMARY KEY,

    ToChar NCHAR(1)

    )

    INSERT INTO #Mapping ( FromChar, ToChar )

    SELECT 1, 'A'

    UNION ALL

    SELECT 2, 'B'

    UNION ALL

    SELECT...

  • RE: Nested Joins - Having syntax and bounding issues

    doasidont (3/31/2016)


    Sorry. Hit go too soon. To continue,

    couldn't I use the same 'Where In' clause to qualify (filter) 'Sales'.empID using 'WorkForce' empID? Workforce.empID lists unique ID's. If so,...

  • RE: Convert a string with an array of variables?

    Alan.B (3/31/2016)


    Sergiy (3/30/2016)


    Solution is suprisingly simple.

    1. Create a "translation" table:

    CREATE TABLE #Mapping (

    FromChar NCHAR(1) PRIMARY KEY,

    ToChar NCHAR(1)

    )

    INSERT INTO #Mapping ( FromChar, ToChar )

    SELECT 1, 'A'

    UNION ALL

    SELECT 2, 'B'

    UNION ALL...

  • RE: Are the posted questions getting worse?

    Michael L John (3/30/2016)


    Maybe we can lobby for VI editor?

    Seen eons ago on alt.religion.emacs

    And the number of the beast is VI VI VI.

    Drew

  • RE: Convert a string with an array of variables?

    pietlinden (3/30/2016)


    Looks like DelimitedSplit8K and a "conversion table" would do the job.

    the DelimitedSplit8K would split out the string into individual characters, and then you could join that to the conversion...

  • RE: Type conversion may affect CardinalityEstimate

    Sergiy (3/29/2016)


    You're inserting varchar values 'DY1' DayNo into nvarchar(4) column.

    It causes an implicit conversion and consequently, the warning.

    If you either change the datatype to varchar(4) or use N'DY1' DayNo...

  • RE: Combining two qureies to one

    GilaMonster (3/30/2016)


    You're not going to get the desired output with a join, left or right.

    I don't know what bo universe is, If it accesses SQL server, can you put the...

  • RE: Pivot table help

    First, the WHERE clause in your subquery is turning your LEFT OUTER JOIN into an INNER JOIN. The purpose of using the LEFT OUTER JOIN in the first place...

  • RE: Creating Combined Queries

    Phil Parkin (3/29/2016)


    Alan.B (3/29/2016)


    You would use AND.

    SELECT vend_id, prod_id, pro_price

    FROM products

    WHERE prod_price <=5

    AND vend_id IN (1001, 1002);

    Disagree. This requires an OR.

    select a from b where condition1

    union (should probably be union...

  • RE: issue with single quotes in the column values

    Use the QUOTENAME function instead of hard-coding the quotes.

    I also recommend that you use the XML string concatenator to create a dynamic table value constructor rather than using UNION all....

  • RE: Combining two qureies to one

    With LEFT and RIGHT the two sides represent independent sets, but with APPLY the RIGHT side can be dependent on the LEFT side. Since the right side IS dependent...

  • RE: Using Subqueries as Calculated Fields

    Eirikur Eiriksson (3/29/2016)


    Quick thought, there is no need for the subquery as this can written as a normal query

    😎

    SELECT

    C.cust_id

    ,C.cust_name

    ,C.cust_state

    ...

  • RE: Using Subqueries as Calculated Fields

    SQL 2016 (3/29/2016)


    I have a concept question on this code:

    SELECT cust_name,

    cust_state,

    (SELECT Count(*)

    FROM orders

    ...

Viewing 15 posts - 2,746 through 2,760 (of 4,087 total)