Forum Replies Created

Viewing 12 posts - 16 through 27 (of 27 total)

  • RE: Count number of distinct rows with two fields as primary key

    Maybe?

    SELECT count(DISTINCT str(ReqID) + str(ClientID)) FROM employees

  • RE: count(*)

    Look your execution plan. I think there is a difference. count(*) will probably use index something and index is probably corrupted.

  • RE: >= on char columns, strange behaviour

    Strange behavior is caused by different database collation.

    I run a test above using following collation: SQL_Slovenian_CP1250_CI_AS and "new-customer" record was missing.

    It works fine using Latin1_General_CI_AS collation.

  • RE: >= on char columns, strange behaviour

    There is s crucial difference between selects:

    first select

    ...

    where order_name >= 'new' -- !! without "-"

    second select

    ...

    where order_name >= 'new-' -- !! with "-"

    It works fine...

  • RE: how to drop default from column?

    Here is script which removes default from column.

    declare @sql varchar(8000)

    declare @cTableName varchar(100)

    declare @cColumnName varchar(100)

    set @cColumnName = 'myCol'

    set @cTableName = 'cisINI'

    select @sql = 'alter table '...

  • RE: Query slows down during the day

    I'm curious.

    Does this

    create table #tmp1(TmpintGroupID int)

    insert into #tmp1 values(1815)

    insert into #tmp1 values(1720)

    insert into #tmp1 values(1409)

    ...

    insert into #tmp1 values(1466)

    SELECT count(*) as [TotalVolume], Sum(monCallCharge) as [TotalCost], Sum(intDuration) as [TotalDuration], Avg(monCallCharge) as [AvgCost],...

  • RE: Chang column type on PK column

    Below is the script which shows what you should do to drop a column like your's. And it's almost 100% complete. All that should be your concern.

    create procedure dbo.SysDropColumnFromTable

    @cTableName varchar(100),

    @cColumnName...

  • RE: Running Number Generation

    Hi ,

    I'm using sql server 2000. ...

    Please, concentrate on posts.

  • RE: Running Number Generation

    Maybe something like this:

    select (select count(*) from sysobjects c where c.id < a.id) + 1

    from sysobjects a

    order by id

    lp, Matjaz

  • RE: Performance Issue!!!Help me please!!!!

    select *

    into tmp

    from test

    where firstname = 'Daniel'

    -- maybe drop foreign keys on table test

    truncate table test

    insert test

    select *

    from tmp

    -- maybe create back foreign keys on table...

  • RE: Nested Update Statement (NEW)

    Example:

    create view v_tb2_tb1

    as

    select t1.id, t1.name, t2.Salary

    from Tb1 t1 INNER JOIN Tb2 t2 on

    t1.id = t2.id

    go

    create trigger tiofu_vtb2tb1 on v_tb2_tb1 instead of update

    as

    set nocount on

    update t2 set salary = i.salary

    from...

  • RE: Nested Update Statement (NEW)

    create a view and instead of update trigger on that view.

    lp, Matjaž

Viewing 12 posts - 16 through 27 (of 27 total)