Forum Replies Created

Viewing 15 posts - 12,091 through 12,105 (of 18,923 total)

  • RE: Need some help with a select statement

    For performance reasons it is better to use a statement like this one :

     

    CREATE PROC dbo.DemoDateRange @iDaysOld as int

    AS

     SET NOCOUNT ON

      Declare @DateStart as datetime

      --Today's date without the time

      SET @DateStart...

  • RE: SQL AUDIT

    Just delete it :

     

    DROP TRIGGER 'TriggerName'

  • RE: SQL AUDIT

    You don't.  It runs only when data is modified (depending on how you set it up).  Once its job is over, then it stops itself untill next execution.

  • RE: Check cns

    It mwans that those objects are linked to that tables.  The first two are check constraints and the last one is a view of course.

    You must also be aware that...

  • RE: Check cns

    What message??

  • RE: COALESCE Vertically??

    CAn you expand on that pk idea??

  • RE: SQL AUDIT

    After the fact : no.  Unless you buy a log reader which can be quite expansive.  A good backup can also do the job.

  • RE: COALESCE Vertically??

    Care to expand on this idea???

     

    "...I don't have to use a datetime in the PK of the log table (which is a bad practice)"

  • RE: Combine Query Into String

    It's under concatenation :

    IF Object_id('ListTableColumns') > 0

    DROP FUNCTION ListTableColumns

    GO

    CREATE FUNCTION dbo.ListTableColumns (@TableID as int)

    RETURNS varchar(8000)

    AS

    BEGIN

    Declare @Items as varchar(8000)

    SET @Items = ''

    SELECT

    @Items = @Items + C.Name + ', '

    FROMdbo.SysColumns C

    WHEREC.id...

  • RE: Row Count

    Com'on guys... that's not something you're supposed to make the server do... unless the whole task is made on the server which is rarely the case.

  • RE: COALESCE Vertically??

    Sorry, emergency time here... no more time on ssc this week...

  • RE: COALESCE Vertically??

    ... and if you're trying to rebuild the whole history of the row then I have no elegant solution to offer.  You might be able to pivot the changes on...

  • RE: COALESCE Vertically??

    ok here's a modified version :

     

    Select ColName, Value from dbo.LogTable LT inner join

    (Select Max(UpdatedTS), ColName FROM dbo.LogTable where Pk = @pk group by ColName) dtLastVersion

    on LT.UpdatedTS = dtLastVersion.UpdatedTS and LT.PK...

  • RE: COALESCE Vertically??

    Something like :

    Select ColName, NewValue from dbo.LogTable LT inner join

    (Select Max(PK), ColName FROM dbo.LogTable group by ColName) dtLastVersion

    on LT.pk = dtLastVersion.PK

     

    Once you have that, have the application or calling proc...

  • RE: SELECT stmt with LIKE returns less estimated rows than with =.

    That's a very good question.. One that I never got around to ask so I have no idea what to answer... I'll let the real gurus take this one

Viewing 15 posts - 12,091 through 12,105 (of 18,923 total)