Forum Replies Created

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

  • RE: excluding nulls from a table

    I agree with Jerry, it is better to change the function to handle the nulls. Changing the function to handle the nulls makes it so that if you pass in...

    Gary Johnson
    Sr Database Engineer

  • RE: Substring function for name

    This is actually a tough question as you never know how the names are formatted or if there are two names for the last name such as "Van Allen".

    Here...

    Gary Johnson
    Sr Database Engineer

  • RE: Need help on performance and integrity

    Thanks for posting the sample data and DML.

    I'm not clear on what you want the output to be. If you can post that maybe we can come up with...

    Gary Johnson
    Sr Database Engineer

  • RE: conditional date check on inserting / updating and having unique rows only

    Try this...

    IF NOT EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS

    WHERE TABLE_NAME = 'YourTableName'

    ...

    Gary Johnson
    Sr Database Engineer

  • RE: Maintenace Plans using T-SQL

    Now, I get to slide out from under the egg... I was thinking that you would use a regular SQL Job with steps created manually rather than the Maintenance Plan...

    Gary Johnson
    Sr Database Engineer

  • RE: Maintenace Plans using T-SQL

    Create the first plan, script it out with Enterprise manager and then change the database name to $(DBName). Save the script to a file. Now create a batch file that...

    Gary Johnson
    Sr Database Engineer

  • RE: What does 2 periods after DB name mean?

    While SQL Server allows this I feel it is a bad practice to have production code to run it. Here is why.

    When SQL sees this syntax it will first...

    Gary Johnson
    Sr Database Engineer

  • RE: Move indexes back to primary file

    Wait a minute. That script doesn't work correctly if there is more than one field in the index.

    Try this.

    SELECT CREATE_INDEX_SQL

    FROM (

    SELECT TBL_NAME = o.name,

    INDEX_NAME =...

    Gary Johnson
    Sr Database Engineer

  • RE: Using Column Values from Table to Query Another Table

    Very sneaky way to case the union in there Barry. I like it!

    Gary Johnson
    Sr Database Engineer

  • RE: Midnight Date Function

    You can also use this...

    SELECT convert(datetime,convert(varchar,GetDate(),10))

    Just replace the GetDate() function with your passed in value.

    It would be interesting to see what performed better. 😉

    Gary Johnson
    Sr Database Engineer

  • RE: Help needed with a CASE

    I would try this. Note that I'm only checking for existence in the case statement based on the left joins. I also removed your UDF in favor of the builtin...

    Gary Johnson
    Sr Database Engineer

  • RE: BULK Import

    Noel,

    That certainly works, but in our ETL system, the format file would be just one more thing for the Operations team to lose. Also, this way we can simply do...

    Gary Johnson
    Sr Database Engineer

  • RE: Return all rows where one is a match

    I would probably write this as follows. No subquery needed... 🙂

    SELECT

    oh.order_no

    , od.order_line_no

    , od.product

    , od.quantity

    FROM...

    Gary Johnson
    Sr Database Engineer

  • RE: BULK Import

    What I do in this situation is to create a view without the ID column and BCP/BulkInsert into that. Make sure to set permissions correctly on both the base table...

    Gary Johnson
    Sr Database Engineer

  • RE: Using LIKE with variables in a SP

    Why not just do this inline?

    WHERE

    srl.QuantityReceipted > 0 AND

    ...

    Gary Johnson
    Sr Database Engineer

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