Forum Replies Created

Viewing 15 posts - 256 through 270 (of 398 total)

  • RE: A better way to summarize Date results?

    Here is the way.

    select EventNumber, EventNameID, min(StartDate) StartDate, max(EndDate) EndDate

    group by EventNumber, EventNameID

    You may have to finish it by puting identity column at the beginning.

  • RE: Single record from Multiple child records via Select statement only

    Here is the test case.

    create table test(id int, sku varchar(5), qty int)

    insert test values(1,'ABC',2)

    insert test values(1,'EFD',1)

    insert test values(2,'SFG',2)

    insert test values(3,'FGE',2)

    insert test values(3,'ABV',3)

    insert test values(3,'JKL',2)

    GO

    select * from test

    go

    create function fnsku (@id...

  • RE: Finding data for child entities

    One way of doing Sales_By_Immediate_Child:

    You may want to finish Sales_By_Immediate_Child_Type. Let me know if having difficult.

     

    create proc Sales_By_Immediate_Child

    (

     @EntityID varchar(30),

     @EntityTypeID int

    )

    AS

     set nocount on

     declare @ChildEntityID varchar(30), @ChildEntityTypeID int

     declare @Result table ([Sales_By_Immediate_Child]...

  • RE: Todays Date

    GetDate() if the function in T-SQL to return Now value.

    You can use default to get value inserted into table without mention the column name.

    For detail information, check BOL (book online)...

  • RE: Help Needed In Table Transformation

    self join case:

    select a.memberNbr, a.effectivedate commentstartdate, min(b.effectivedate) commentenddate, a.comment

     from table a

     left outer join table b on a.memberNbr = b.memberNbr and a.effectivedate < b.effectivedate

     group by a.memberNbr, a.effectivedate, a.comment

     order by a.effectivedate

     

    Here assume...

  • RE: Finding data for child entities

    Base on the sample.

     

    create function fnTerminalEntityID (@EntityID varchar(30), @EntityTypeID int)

    returns @TerminalEntity table (EntityID varchar(30), EntityTypeID int)

    as

    begin

     declare @level int

     declare @stack table (entityid varchar(30), entitytypeid int, level int)

     insert into @stack values(@EntityID, @EntityTypeID,...

  • RE: Preventing DBAs from looking into the data

    encryption

  • RE: SQl NOLOCK usage

    put nolock after all table name. Or set isolation level to read uncommitted.

  • RE: Restoring Log Showing 2 Different Result. Which one should I trust?

    The first method is actually file=1.

    Try to restore whole file in one go, you have to restore every file in the log.

    Use restore header only to get number of files...

  • RE: Index not used on Select *

    Try to update statistics, then run the query again.

  • RE: Turning off Column Headers in an Stored Procedure ?

    If running from query analyzer, you can turn it off by click tools in menu, options, results, clean Print column headers(*) check box.

    If running from osql, -h-1 is the answer.

  • RE: extended strored procedure problem

    It is not necessary to put dll in 'path'.

    Registers the extended stored procedure with following, specify dllname with full path. 

    sp_addextendedproc [ @functname = ] 'procedure' ,

        [ @dllname = ]...

  • RE: Relplace all but a-zA-Z0-9

    create function fn_cleanup (@i varchar(4000))

    returns varchar(4000)

    as

    begin

      declare @return varchar(4000)

      set @return = @i

      while patindex('%[^a-zA-Z0-9]%', @return) != 0

      begin

        select @return=replace(@return, substring(@return, patindex('%[^a-zA-Z0-9]%', @return), 1), '')

      end

      return...

  • RE: Data Tansfer fails

    Put tempdb auto growth may solve the problem.

  • RE: Data Tansfer fails

    Did the error message mention which object failed to allocate space?

    Try to create an user filegroup as default and run the script (if create object statements do not have primary hard coded).

Viewing 15 posts - 256 through 270 (of 398 total)