Forum Replies Created

Viewing 15 posts - 46 through 60 (of 223 total)

  • RE: How to add below complex conditions in SQL script..

    Please format your query. Do you feel comfortable looking at it?

    Split the query into two parts. Use a temp table. Branch out your query using IF ELSE. Don't worry...

  • RE: Remove Time from DateTime

    In the DateAdd function, third parameter is date. 2nd parameter is the increment.

    When you write DATEADD(d,0,getdate())

    0 days are added to current date.

    When you write DATEADD(d, DATEDIFF(d, 0, @Today), 0);

    the...

  • RE: Move Database From One Server to Other

    It's funny how folks miss to read what the error message says.

  • RE: How to Convert Semi colon Separated Values into Column

    Life will be much easier if you pass that as an XML parameter.

    DECLARE @x XML =

    '

    <Items>

    <Item>

    <ItemCode>T1</ItemCode>

    <ItemName>Pencil Box</ItemName>

    <Amount>1900</Amount>

    </Item>

    <Item>

    <ItemCode>T2</ItemCode>

    <ItemName>Eraser</ItemName>

    <Amount>2000</Amount>

    </Item>

    <Item>

    <ItemCode>T3</ItemCode>

    <ItemName>Mouse Pad</ItemName>

    <Amount>8900</Amount>

    </Item>

    </Items>

    ';

    SELECT

    i.value('(ItemCode)[1]','varchar(50)'),

    i.value('(ItemName)[1]','varchar(50)'),

    i.value('(Amount)[1]','numeric')

    FROM

    @x.nodes('//Items/Item') TAB(i)

  • RE: sql server stored procedure logic problem

    You should find out what is causing the error and handle it in the script rather than adding try catch for this purpose. Error may be from datatype mismatch or...

  • RE: Does a SP get precompiled?

    Thanks Gail.

  • RE: Does a SP get precompiled?

    Thanks Gail. For an SP, there can be multiple entries in the dm_exec_query_plan DMV even without SP recompilation is what this implies, right? Will insertion into temp table cause recompilation...

  • RE: Does a SP get precompiled?

    Recompilation may not happen if you are writing a simple select as in - select 1,2. If you are selecting from a table or tables and there is filtering involved,...

  • RE: Guidance on table valued types.

    Thanks Craig, such has been my experience as well.

  • RE: Guidance on table valued types.

    Jeff Moden (3/3/2013)<snip/> For example, 40,000 INDEX SEEKs behind the scenes can be quite a bit slower than a single scan at the leaf level.

    Jeff, in this case, won't optimizer...

  • RE: Deletes taking long time

    Yes, as mentioned above, delete in batches, unless the performance of the target DB does not matter. Any sort of bulk operation causes major index maintenance activities and they are...

  • RE: Guidance on table valued types.

    Hmm, may not be worth it, you know. There is only one column in the table. If you had more columns and if filtering was performed on the key column...

  • RE: Query Analyzer

    I was working on a remote machine and while I was away, the machine was restarted. Lost the scripts I had unsaved, or so I thought; and then I came...

  • RE: Query to list all jobs

    Cool, threads will remain open. May be, someone will have a question related to the same topic or someone will find a better solution. Threads don't get locked in SSC....

  • RE: How to display Columns based on other table values

    Cool, that's correct. Also, make it a practice to check out execution plans of all queries that you write, if you don't do that already (Ctrl + M).

Viewing 15 posts - 46 through 60 (of 223 total)