Forum Replies Created

Viewing 15 posts - 571 through 585 (of 626 total)

  • RE: dynamic sql question

    Have you looked into setting up a CMS (Central Management Server)?

    Cursor's and Dynamic SQL aren't bad per se but rather can cause issues when not executed properly. Try to...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Handle Names

    You have to escape it by adding another single quote.

    'James O''Neil'

    You can test it out.

    DECLARE @TEST NVARCHAR(20)

    SET @TEST = 'James O''Neil'

    SELECT @TEST


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Date sequence missing values

    This is how I did it

    DECLARE @testdata TABLE (id int, date datetime, Amount int);

    DECLARE @testdates TABLE (date datetime);

    INSERT INTO @testdata (Id, Date, Amount)

    SELECT 1, '1/6/2014' , 21 UNION ALL

    SELECT 1...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Need to retrieve first occurrence of Invoice detail

    As Sean has mentioned some sample data would be very helpful here. That being said I have a funny feeling you are getting the same data multiple times because...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Minimize migration downtime on large DB

    sql-lover (4/20/2015)


    Tip

    Check for orphaned SIDs. You need to reset those if you moved to a different SQL instance and you use SQL logins.

    You're right about that one...I've been stung by...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Minimize migration downtime on large DB

    udaynov17 (4/20/2015)


    How about setting up log shipping and run the scripts for the backup and restore of the last T-Log in the time of cut-over.

    This would probably work also but...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Compare column in two tables

    Alan's answer works and is nice and clean. I figured I'd add my take since I was already looking into it. Often there are more than a few...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Find P.O. Box and Replace with Post Office Box

    SELECT REPLACE(Address2,'P.O. Box','Post Office Box') AS Address2 FROM CLAddress

    https://msdn.microsoft.com/en-CA/library/ms186862(v=sql.100).aspx

    better yet...

    https://msdn.microsoft.com/en-us/library/ms181984(v=sql.100).aspx

    I realize you may not have known about the REPLACE function but the previous posters were trying to push you in...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Any workarounds or idea's for this senario?

    Just throwing it out there but why do they have to write back to the same DB they read from? I'd have them pull from the read only unless...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Link tables

    legeboka (4/16/2015)


    I agree with your assessment but data coming from different vendors and my task to reconcile it. I can’t change table structure

    I rigged up an example for you before...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Link tables

    I have to give you a thumbs up for providing the sample data and code.

    The bad news is your table structure is what's killing you. I'll admit I obviously...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Query to do exception report based on 2 values in a specified field

    -OLDdogNEWtricks- (4/14/2015)


    Thank you for that...it works fine for a single execution. If you try and run it again it reports that the object '#Temp' already exists in the database.

    I just...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Query to do exception report based on 2 values in a specified field

    Ok so if you only care about locating Package Numbers that have a CDI but does not have a POD this should work.

    SELECT

    Field6 AS PackageNumber,

    MAX(CASE WHEN Field4 = 'COLLECTION/DELIVERY INSTRUCTION'...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Combining Tables

    Try this:

    SELECT

    u.USERID,

    u.NAME,

    u.PHONE,

    ui1.INFO AS Sport,

    ui2.INFO AS Food

    FROM

    [User] u

    JOIN UserInfo ui1 ON u.USERID = ui1.USERID AND ui1.COLUMN = 10

    JOIN UserInfo ui2 ON u.USERID = ui2.USERID AND ui2.COLUMN = 30


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Query to do exception report based on 2 values in a specified field

    You need to realize that there are NO duplicates in your sample output. The different DocumentID's make the rows completely unique no matter how much other data appears to...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 15 posts - 571 through 585 (of 626 total)