Forum Replies Created

Viewing 15 posts - 226 through 240 (of 425 total)

  • RE: Syntax error.

    pommguest99:

    the bold areas below are incorrect.

    CREATE PROCEDURE

    CompareTables(

    @filefit nvarchar(100),

    @(select bb.Vraiid, pc.FLCA

    from blueribbon bb

    join...

  • RE: looking up in the tree

    rbarryyoung (4/4/2008)


    rbarryyoung (4/3/2008)


    OK, corrected version:

    Select A.*, B.*

    From TableA A

    Left Outer join TableB B

    ON B.CompanyID = Left(A.CompanyID

    , (Select MAX(len(B2.CompanyID)) From TableB B2

    Where B2.CompanyID = Left(A.CompanyID, Len(B2.companyID))

    And (...

  • RE: Using Case to find the difference

    CASE statement isn't necessary, just use ABS(). if you have nulls, wrap both in ISNULL().

    "Diff" = ABS( ISNULL(ea.lev1,0) - ISNULL(b.firstline,0) )

  • RE: Indexed View Sql Server 2005

    Sandy: not sure why your view isn't using the clustered index but the group by is not the issue. using your sample data script, here's my sqlcmd results:

    2>...

  • RE: SQL server versus SQL server express

    you definitely won't get any performance benefit by downgrading to sql server express since

    a) express can only utilize 1 CPU core while other versions can use multiple cores

    b) express can...

  • RE: looking up in the tree

    rbarryyoung (4/3/2008)


    I do not have time right now to do an optimal version, but this should be better than an iterative or recursive solution:

    Select A.*, B.*

    From TableA A

    ...

  • RE: Which is Better....

    i'm not disagreeing with you matt regrading outer joins. i'm simply pointing that in some complex queries with inner joins, the execution plan (and performance) can be changed by...

  • RE: Copying a Table Between Databases

    look for BCP in your SQL Server documentation. it's made for moving data in/out of SQL Server.

    from the operating system command line, the basic syntax is like so:

    bcp source_database..source_table...

  • RE: Which is Better....

    vinojsasidharan (4/3/2008)


    So if i understand correct the best option is to have it in the FROM clause itself, got confused with the replies.

    no, best practice is the JOIN conditions should...

  • RE: Table comparision

    i'm confused by this:

    Now how do I list out the different data values that are not common to each table & also show what data is there in what table.

    if...

  • RE: Copying a Table Between Databases

    what about:

    bcp out to a file

    zip the file (if big)

    ftp/copy the file/zip

    unzip the file (if necessary)

    bcp in from file

    if the table has identity columns or computed fields, you'll need a...

  • RE: Which is Better....

    to add to mark's comment...

    ideally, the FROM clause should describe how the tables JOIN together (dept join emp on dept.deptId = emp.deptId) and the WHERE clause should have criteria for...

  • RE: Convert Question

    your approach depends on the setting of CONCAT_NULL_YIELDS_NULL.

    if CONCAT_NULL_YIELDS_NULL is ON, then you can just do this:

    When GCStatus='Redeemed'

    Then 'redeemed '+ Convert(varchar(20),RedeemedDate,101)+

    ...

  • RE: using count for 2 tables

    John Doe should only have 2 sales, not 4.

    SELECT a.userid,

    COUNT(distinct a.salesid) as num_sales,

    COUNT(b.amount)...

  • RE: looking up in the tree

    i couldn't figure out how to do it with a CTE, but here's a loop that works.

    create table #tableA ( companyId varchar(255) )

    create table #tableB ( companyId varchar(255), companyName varchar(255))

    ;

    insert...

Viewing 15 posts - 226 through 240 (of 425 total)