Forum Replies Created

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

  • RE: Updating Global Variable via Scheduled Job

    Yep, that is what I was hoping would happen.  Should I just use a table to store the value if I want it to persist?

  • RE: Query help for results order

    Nevermind, I see what it is for.

  • RE: Query help for results order

    I'm confused about splitting the list values.  Why is this done?

  • RE: Query help for results order

    Remi, can you walk me through your solution?

  • RE: Group By with Non-Aggregate Function

    From my understanding, every selected field must be part of either the GROUP BY clause or an aggregate function. Can you provide some sample data to explain which field...

  • RE: Query help for results order

    What about having a second table (ProductSort) that stores your specific sort order...

    Product_ID     SortOrder

         31                1

          5                 2

          7                 3

          9                 4

         12                 5

    Then do your SELECT statement like this...

    SELECT * FROM...

  • RE: Creating and managing records with triggers

    Hi,

    Does your unique ID have to be an incremental integer type?  If not, I would just concatenate the values of SetCode, SubjectCode and YearCode to generate a unique...

  • RE: Reshaping vertical data to horizontal layout.

    Here is another dynamic SQL option...

    1. Create a temp table that has an identity column (RowNum) and an integer

    column (IndValue).  

    CREATE TABLE #TempTable (

     RowNum int Identity (1,1) Not Null,

     IndValue int Not...

  • RE: Need help badly

    Hi,

    I would recommend storing all of the shift information in one table adding a field called shift status (with the possible values of worked, cancelled or open).  If you have to use...

  • RE: ON INSERT FOR EACH ROW Trigger

    Here's how I did it using a cursor..

    CREATE TRIGGER [SendErrorNotification] ON dbo.ClickonError

    AFTER INSERT

    AS

    DECLARE @edit varchar(15)

    DECLARE cedit CURSOR FOR

    SELECT EditNumber

    FROM INSERTED

    OPEN cedit

    FETCH NEXT FROM cedit

    INTO @edit

    WHILE @@FETCH_STATUS = 0

    BEGIN

    --add the...

  • RE: GRANT DROP?

    Hi,

    You're right.  It seems like a catch-22.  I was trying to grant permissions in the stored procedure but the user/role doesn't have the rights to assign permissions.

  • RE: Dynamic SQL String

    Ooops.  Forgot that I wanted to calculate age from @RptDate, not GetDate().

    This works:

    SET @strSQL = @strSQL + ' CAST(DateDiff(d,CS.AdmSrvDate, ' + '''' + CONVERT(varchar,@RptDate,101) +''''+ ') AS nvarchar(5)) END'

  • RE: Dynamic SQL String

    Thank you, Frank!  This worked:

     

    SET @strSQL = @strSQL + ' CAST(DateDiff(d,CS.AdmSrvDate,  GetDate()) AS nvarchar(5))'

  • RE: Dynamic SQL String

    The larger statement as a whole needs to be dynamic. I'm using a stored procedure as a datasource for a Crystal report.  The joins in the SQL statement need to change...

  • RE: Dynamic SQL String

    Thanks!

    What if I want to use a variable in the DTS, for example, @RptDate, instead of GetDate()?

    Brenna

     

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