Forum Replies Created

Viewing 15 posts - 421 through 435 (of 1,048 total)

  • RE: Query Help

    Cadavre (6/29/2013)


    kapil_kk (6/29/2013)


    Hi,

    I need help in getting this type of output, I tired with MIN and MAX function but didnt get required output:

    Create table T1

    (Id int identity primary key,

    VoucherNo varchar(10),

    TransNo...

  • RE: Top 2 with Count

    I think this will work for you....

    declare @N int=2

    If ISNULL(@N,0) = 0

    select * from

    (

    select 10 'Top 2'

    Union

    Select 20

    Union

    Select 30

    union

    select 40

    union

    select 50

    )T1

    ELSE

    select top(@N) * from

    (

    select 10 'Top 2'

    Union

    Select 20

    Union

    Select 30

    union

    select...

  • RE: Top 2 with Count

    Nilandri, can you please post what changes you made in your query so that other s can also learn from that thing...

  • RE: How to avoid this error when scripting multiple sp? Thanks.

    Use Go batch separator as Luis suggested...

  • RE: Between Clause

    Danny Ocean (6/26/2013)


    I never used between for string operation. I also never seen this kind of condition in working scenario.

    :doze:

    Same here...

    I dont think there is any need of using BETWEEN...

  • RE: Very specific query

    Sean Lange (6/26/2013)


    kapil_kk (6/26/2013)


    you can do the same thing as Sean did using SUBSTRING also:

    SELECT id,

    SUBSTRING((SELECT ', ' + Term

    FROM Something s2

    WHERE s1.id = s2.id

    and s2.Type = 'Subject'

    ORDER BY s2.Term...

  • RE: Data movement from one server to another

    Lowell (6/26/2013)


    i would do a backup and restore as -a-new-database name so both sources are on a single instance, and then review the differences for either specific insert/update/delete, or a...

  • RE: Very specific query

    you can do the same thing as Sean did using SUBSTRING also:

    SELECT id,

    SUBSTRING((SELECT ', ' + Term

    FROM Something s2

    WHERE s1.id = s2.id

    and s2.Type = 'Subject'

    ORDER BY s2.Term

    FOR XML PATH('')),...

  • RE: Very specific query

    Hi Sean,

    I know to print comma seperated values using FOR XML.

    But I was trying the same solution using COALESCE like this:

    DECLARE @var varchar(max)

    SELECT @var = coalesce(@var +',','') + term from...

  • RE: Database Backup Restore

    KWymore (6/25/2013)


    Nice question. I have never used this option. Good to know!

    +1 🙂

  • RE: Script all stored procedures modified after a given date? ...

    Andrew G (6/25/2013)


    Procedures and their definitions modified in the last 7 days

    SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition

    FROM sys.sql_modules AS sm

    JOIN sys.objects AS o ON sm.object_id = o.object_id

    WHERE...

  • RE: query

    nicklibee (6/25/2013)


    thank you ,, Luis ,,that's the exact answer,,,

    neglect these humpty dumpties, they can't even understand what a poster wants..

    pitty some fellows here, they can't understand simple things...

  • RE: Temp Table

    Danny Ocean (6/24/2013)


    Easy and good basic question. 🙂

    Sometimes its good to play around basic. Its refresh us. 🙂

    Thanks

    +1 :-):-P

  • RE: Change Data Capture - SQL Server 2008

    WHen you are enabling CDC on table, you are executing a sp in this manner:

    EXEC sys.sp_cdc_enable_table

    @Source_schema = N'dbo',

    @source_name = N'tblEmployee',

    @filegroup_name = N'PRIMARY',

    @supports_net_changes = 1

    GO

    It will ...

Viewing 15 posts - 421 through 435 (of 1,048 total)