Forum Replies Created

Viewing 15 posts - 31 through 45 (of 51 total)

  • RE: Two database on one instance using relication

    Do you want to run multiple databases on the same instance and replicate them to another server? If so then yes, it is very possible.

  • RE: How to search for a pattern of consecutive records?

    This works for me on the sample data. Performance might be a problem on large datasets.

    CREATE TABLE #tbl1(number INT , animal VARCHAR(10) , grade CHAR(1) )

    INSERT INTO #tbl1

    select 1,'cat','a'

    UNION...

  • RE: locks in Transactions

    Second that,

    Let SQL server handle the locks and do not give a hint.

    Also, SQL will upgrade locks to page locks/ table locks if needed - you do not have to...

  • RE: Update trigger is not working

    Updated records have a row in the INSERTED and the DELETED table.

    Try something like this...

    IF ( SELECT count(*) from INSERTED ) > 0 AND ( SELECT count(*) from DELETED...

  • RE: storing xml file vs splitting the column

    I will answer your question by telling you what we did in our database with XML data...

    When we stored and queried XML documents in the database, we found querying to...

  • RE: Query with Execution Plan

    Yes,

    That's correct.

    Just remember that you will still need to supply the order by clause as otherwise you cannot guarantee that the results will be ordered. To change the key just...

  • RE: Query with Execution Plan

    The clustered indes spans both columns as you said. So the table will look like this :

    SELECT top 5 [ProductID] , [LocationID] FROM [Production].[ProductInventory]

    ProductID LocationID

    11

    16

    150

    21

    26

    Everything is first sorted by the...

  • RE: Query to convert Row data to columns

    This is the dynamic one. I prefer not to do dynamic SQL in my projects but sometimes it is unavoidable. Maybe see if you can do something on the client...

  • RE: Query to convert Row data to columns

    This is how to do it if you know how many aliases you are going to have:

    ;WITH CTE_PIVOT

    AS

    (

    SELECT

    Applicationid,

    CASE SOURCE WHEN 'AR' THEN applicationname ELSE NULL END AS applicationname,

    CASE ROW_NUMBER()...

  • RE: Correlated sub query takes more time to return result

    This also works for me and seems slightly faster than the convert to varchar.

    select f.*

    from xxxxflow f

    inner join (select

    MAX(mstr_ordid) as mstr_ordid,

    Ord_Num ,

    convert(datetime,(floor(convert(float,date)))) as d1,

    convert(datetime,(ceiling(convert(float,date)))) ...

  • RE: xml function

    You can convert the column to an XML datatype. Then you can use Xpath etc to query the xml. You can also create indexes on XML columns so that could...

  • RE: Index Usage

    Here is my take on it. (90% confident)

    Because it is a clustered index, the leaf level pages of the index is the data rows in the table. So you will...

  • RE: How can we delete having refece keys

    You specify cascading when you create a table. You use the ON DELETE CASCADE clause.

    In the example below, if you delete a line in the purchaseorder table, it will automatically...

  • RE: xml function

    The function takes a text string and converts it to an XML data type and returns the converted XML data.

    It seems the input text also is not in the correct...

  • RE: Update Query Syntax: help!

    This works on my machine. I removed the a. in the set clause, see if it helps...

    CREATE TABLE #temptable1(col1 int , col2 int, col3 int, col4 int, col5 int)

    CREATE TABLE...

Viewing 15 posts - 31 through 45 (of 51 total)