Forum Replies Created

Viewing 15 posts - 226 through 240 (of 445 total)

  • RE: Filtering tables with sp_MSforeachtable

    Try

    ... @whereand=N' and Object_id in (select Object_id from sys.objects

    where name in (select article from distribution..MSarticles where ... ))'

  • RE: Stored Proc returning inconsistent results...

    It's quite possible to store a non-unicode value in NVARCHAR column:

    declare @nvc1 nvarchar = 'test'

    declare @nvc2 nvarchar = cast('test' as varbinary(100))

    if @nvc1 = @nvc2

    PRINT 'EQUAL'

    else

    PRINT 'NOT...

  • RE: Create table from rows of a different table

    By chance, is there any reasonable limit of number of TBTAB2 columns needed for the period of the application life ?

    Suppose max is 25 columns. Then create a table...

  • RE: Remove data from tables

    Mauricio_ (3/5/2015)


    I only marked option F). Option D) has a wrong syntax.

    +1

  • RE: Best SQL Challenege: TSQL Query Maximum Concurrent Connections (Participants)

    Alternatively we can count concurrent calls based on second-granularity tally and then compute max concurrency within bucket.

    declare @repStart datetime = '2013-04-01';

    declare @repEnd datetime = '2013-04-02 23:59:59.9';

    with sampledata as(

    Select...

  • RE: Best SQL Challenege: TSQL Query Maximum Concurrent Connections (Participants)

    Not sure I got it right, but lets start with enumerating buckets of interest. If the query brings the proper list of buckets with concurrent calls then...

  • RE: Tree View Hierarchy Query

    Try recursive cte as follows. I changed your input so that grandparent 1 has two different paths with IsAutoCalculate =(1...1,0) . You may need to tweak the query...

  • RE: T sql

    Barcelona10 (2/26/2015)


    SELECT t1.*,t2.dueDate

    FROM Table1 t1

    LEFT JOIN Table2 t2 ON t1.ID = t2.ID

    WHERE t2.dueDate='2014-01-02'

    GO

    SELECT t1.*,t2.dueDate

    FROM Table1 t1

    LEFT JOIN Table2 t2 ON t1.ID = t2.ID

    AND...

  • RE: Try catch block in while loop

    and more, looping

    Select * into #temp from Employee where Name=@Name

    will give you n*m rows for every name which has n occurences in the given department in Total and m...

  • RE: Suggestion for replace a function or method

    Why you need view and function?

    What's wrong with a single query

    select Id,ProductName,IsActive,

    CONVERT(XML,

    (SELECT TBL_Group.title, dbo.TBL_Group.id

    FROM TBL_Group INNER JOIN

    TBL_GroupProd ON TBL_Group.Id = TBL_GroupProd.GroupId

    WHERE TBL_GroupProd.ProdId = TBL_Product.Id FOR XML...

  • RE: Generate Records For gaps To Create A Chart for every Date

    sm_iransoftware (2/25/2015)


    (And The other side : I have a table that have All Day Date and can join to these tables)

    Ok then what is your problem? Have you tried the...

  • RE: Help With Select Query

    Jay Sapani (1/26/2015)


    first of all serg-52 no need to be sorry.

    thanks for the solution.

    want a suggestion on some nice way to improve knowledge of new sql as till now i...

  • RE: How to add missing IDs in a SQL table?

    Tally needs only 5 members because OP needs to derive only 4 rows from each original row. Provided there are no 2 original rows where abs(r1.id-r2.id) < 5 ,...

  • RE: my trigger does not update datetime?

    One more point, the trigger will fail when database is altered to RECURSIVE_TRIGGERS ON. Try this

    alter trigger trigUpdateDateProductsL1 on ProductsL1

    after update

    as

    if not UPDATE(UpdtDT)

    begin

    --print 'updating Data';

    UPDATE dbo.ProductsL1

    SET UpdtDT =...

  • RE: Help With Select Query

    Sorry for the late answer.

    If you're still struggling with the problem try this. As there may be multiple intervals for a given MapPerson/Mapgroup, we need to know next interval info....

Viewing 15 posts - 226 through 240 (of 445 total)