Forum Replies Created

Viewing 15 posts - 121 through 135 (of 457 total)

  • RE: Poll: SQL Server Builds...

    Personally I do something like #2... only after testing. And allowing the rest of the community to sniff out the problems first. Unless there's some sort of...

  • RE: Update statement help please!

    You need to move the joins down...

    UPDATE tblMsgIMP

    SET ... (that whole string)

    FROM tblMsgImp INNER JOIN tblMsgImp AS tblMsgImp_1 ON tblMsgImp.MID = tblMsgImp_1.MID

    WHERE ... (where clause)

    That should work.

  • RE: Calling a stored produre from w/in another

    Using the syntax EXECUTE @Foo= sprocB will set @Foo to the RETURN value of sprocB. If sprocB issues a SELECT statement, then that result...

  • RE: Adding columns

    If you post the query it might be a little easier, but you should be able to do something akin to...

    SELECT SUM(period1) + SUM(period2) + SUM(period3) AS allperiodsums

  • RE: A Cool Perk

    At my work we have a gym, the option to meet with a personal trainer once per week for personal or group classes. Breakfast catered once per month with...

  • RE: getting the object name using the object_id?

    Try the object_name() function... 😉

    SELECT object_name(12345)

  • RE: Searching/Altering Stored Procedures

    Sergiy has a good way down the line... in the interim if you need to find all procedures containing a certain string:

    select * from information_Schema.routines where routine_definition like '%linkedsrvname%'

  • RE: use NOT IN for multiple fields?

    Also NOT IN can cause serious performance issues, you're always better off using a left anti-semi join as Daryl illustrated.

  • RE: just the date, please

    I'm not sure how different it is (haven't tested it yet), but I recall reading an article a few years back that said that this method was actually the fastest:

    DATEADD(dd,...

  • RE: Finding if files exist.

    I'm sure you can do it via an SSIS package, but honestly I'd rather do it using sys.xp_fileexist.

    Try doing:

    EXEC master.sys.xp_fileexist 'C:\Folder\Myfile.ext'

  • RE: Execute SQL and Errors

    CREATE PROCEDURE MyTestProc

    AS

    DECLARE @Err INT

    SELECT GETDATE()

    SELECT @Err = @@ERROR

    IF @Err 0

    BEGIN

    RAISERROR(‘My Error’,16,9)

    RETURN(@err)

    END

    ELSE

    RETURN(0)

    Usually setting a return value which is nonzero indicates failure.

  • RE: 2005 Installation Problems

    Are you a member of the administrators group on the local machine?

  • RE: HELP! USING THE CASE STATEMENT WITH AN AGGREGATE FUNCTION

    Maybe I haven't had my coffee yet, but you should be able to just replace NumOrders with COUNT(*)...

    CASE

    WHEN COUNT(*) > 100 THEN 'Bonus'

    ELSE 'No Bonus'

    END

    Also drop off the second column...

  • RE: Dynamic SQL from within a Table Valued function?

    Perhaps give an example of what you're trying to do (even if it won't work)?

  • RE: Forcing a Carriage Return/Line Feed within data

    Look into using the CHAR() function (not the datatype). If I recall correctly it's something like CHAR(13).

Viewing 15 posts - 121 through 135 (of 457 total)