Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • RE: excluding a range in a query

    Try to build your query like this

    SELECT * FROM TABLEname WHERE ColumnName='BA00044' OR ColumnName NOT LIKE 'BA%'

  • RE: How to reordering or removing one identity number

    Hope this helps.

    create table tblname (id int identity(-1,1),name varchar(2))

    DECLARE @MAXID INT

    SELECT @MAXID = MAX(id) FROM tblname

    --if @MAXID + increment value = 0

    if(@MAXID+1=0)

    BEGIN

    SET identity_insert tblname ON

    insert into tblname(id,name) values('1','d')

    SET identity_insert tblname...

  • RE: SQL Query help

    Another way of doing this using GROUP BY,

    with cte1 as (

    select DT from dp group by DT having COUNT(distinct type)=1 and count(nr)>1

    ),

    cte2 as (

    select DT from ln...

Viewing 3 posts - 1 through 3 (of 3 total)