Forum Replies Created

Viewing 15 posts - 1 through 15 (of 18 total)

  • RE: compare two columns

    use a case statement:

    select case when column1 > column2 then column1 else column2 end as Result;

  • RE: Splitting Parent Table Data into Several Tables

    It looks like you're overthinking it. Try something like this:

    INSERT INTO aaa_test_users (UserName, first_name, last_name)

    FROM aaa_test_sp

    INSERT INTO aaa_test_users_positions (UserID, position, phone)

    SELECT aaa_test_users.UserID, aaa_test_sp.position, aaa_test_sp.phone

    FROM aaa_test_sp

    join...

  • RE: When to separate SSIS packages?

    I'd have them all as separate packages. You can have a new "Master" package which calls the others one by one, one advantage of this is that the called packages...

  • RE: Creating a Query to show data side by side

    It took me a little while to figure this out, and it may still need some further tweaking, but this query returns the rows in a phone book format:

    declare

  • RE: Avoiding duplicates from file import

    Just as a point of information, the ID field in tbl_Data is what we're calling a surrogate key, it's called a surrogate because the value of the ID has nothing...

  • RE: Avoiding duplicates from file import

    You can have several indexes on a table, but the data is physically stored on the disc in the order of the clustered index. This is why using a surrogate...

  • RE: Working out currency pairs

    Is your sample data correct? You've got GBP to USD showing as 1.587, and you've also got USD to GBP as the same rate.

    I'd start by simplifying the exchange rate...

  • RE: Avoiding duplicates from file import

    What's the difference between the dump table and the holding table? It looks like you're importing the data into one table just so you can index it and then move...

  • RE: General approach BULK INSERT, SELECT INTO, RENAME

    I've seen a similar approach used in the past when populating a large data warehouse that took several hours. A copy of the database was created and populated, and then...

  • RE: Avoiding duplicates from file import

    I'd import the text file into a staging table and then run a merge statement to copy any new data into the live table.

    Maybe you can get the SSIS package...

  • RE: Multiple Rows Into a Single Row

    This should give you what you want:

    select ContractNumber, MAX(pc1) as pc1, MAX(pb) as pb, MAX(om) as om, MAX(vp) as vp

    , MAX(BillClerk) as BillClerk, MAX(BillCord) as BillCord, MAX(OpsMgr) as OpsMgr,

    MAX(VicePres) as...

  • RE: Creating missing records....

    Note: I posted some code, removed it because it didn't work, and then posted this code in its place.

    Try something like this:

    declare @data table (groupid int, salesperhour tinyint)

    declare...

  • RE: Transaction Log lots of free Space

    Thanks for that, I'll have a look at those articles later. Still had to do some googling to find out what VLF stands for though, as she doesn't give a...

  • RE: Transaction Log lots of free Space

    If you're backing up the transaction log then SQL Server should start reusing the space in the log file after the backup has finished. You could shrink the log file...

  • RE: SQL server newbie

    JJR333 (10/31/2014)


    ... shrink the database...

    Just be aware that if you do this you'll fragment all your indexes. Also it's generally frowned upon because the server will only have to grow...

Viewing 15 posts - 1 through 15 (of 18 total)