Forum Replies Created

Viewing 15 posts - 46 through 60 (of 89 total)

  • RE: Trigger question

    Does any 30 minute period reset the loginattempts back to zero?  I would not use a trigger for this.  Putting it in a trigger would cause the trigger to be...

  • RE: Union Problem

    Did you look at the execution plans for both the queries individually and the full query using the UNION statement?  Can you post your table structure along with indexes...

  • RE: Table location on Filegroup?

    This should work.  You may want to join to sysobjects to limit the scope to just user tables??

    select distinct object_name(id), si.groupid, sf.groupname

    from sysindexes si, sysfilegroups sf

    where si.groupid=sf.groupid

    Recommend only using this...

  • RE: Store Provedure Calling Store Procedure

    You can create the temp table in the first procedure with the columns that are always in the table, or at least with a column that will just serve as...

  • RE: Using the IN operator with a variable

    Try

    DECLARE @List varchar(100)

    SET @List = '''ONA'', ''TSV'', ''KVS'''

    Also, you will need to execute the entire statement as dynamic SQL.

    SELECT @List='SELECT * FROM Table WHERE Column IN ('+@List+')'

    SP_EXECUTESQL (@List)

    Brian

  • RE: Slow query help needed!!!!

    What happens if you change the NOT IN to a LEFT OUTER JOIN in the first query and the IN to a INNER JOIN in the second query?  Hopefully my...

  • RE: Very basic question - Insert or Update?

    Why not check the rowcount after initiating the update statement.  If nothing is updated, then issue an insert statement.

    UPDATE ...

    IF @@ROWCOUNT=0  -- No records updated, so it doesn't exist and...

  • RE: Getting a Date from DateTime

    Frank,

    Why do you believe creating a function is among the worst possible solutions?  I guess I like to create functions for commonly used conversions.  Not only do I help assure...

  • RE: Retrieve list of IDs for records meeting criteria

    Or, you could add a trigger to the history table that will maintain a table for the last five inserted records for each id.

    create table test (ID int, canned varchar(10), realtime...

  • RE: Retrieve list of IDs for records meeting criteria

    If each ID has a consecutive dates in the realtime column, you could do something like:

    select id                                                                                                                                                 from (select id, realtime from history where realtime>dateadd(day,-5,getdate()) and canned='fOff') a                    group by...

  • RE: comma separated values usage in where clause

    If you are going to store a comma seperated list and then want to search for distinct values in the list, you will need to include a leading comma with...

  • RE: @@IDENTITY not returning proper INT

    You can use SCOPE_IDENTITY() instead of @@Identity or IDENT_CURRENT.  It will return the identity value you just inserted and ignore the result of the trigger.

    Brian

  • RE: Stored Procedure to return record id of record matching search criteria!

    Will this work?  I added a #log table to the procedure and insert the values into the #log table instead of doing an "if exists".  Then select from the #log...

  • RE: Insert Trigger

    If the value is based on running a function against the identity field, you should be able to use a caclulated field.

    CREATE   FUNCTION [Add2] (@id INT)   

    RETURNS INT AS   

    BEGIN  ...

  • RE: Query Problem

    This should give you a list of the document numbers. 

    select distinct a.*

    from (select f.docnum from F0413 f, F0911 ff where f.docnum=ff.docnum and ff.doctype='pk') a

     left outer join 

     (select f.docnum from...

Viewing 15 posts - 46 through 60 (of 89 total)