Viewing 15 posts - 46 through 60 (of 223 total)
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...
March 14, 2013 at 4:28 am
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...
March 7, 2013 at 3:28 am
It's funny how folks miss to read what the error message says.
March 7, 2013 at 3:06 am
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)
March 7, 2013 at 2:35 am
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...
March 7, 2013 at 2:32 am
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...
March 5, 2013 at 5:53 am
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,...
March 5, 2013 at 4:02 am
Thanks Craig, such has been my experience as well.
March 4, 2013 at 2:12 am
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...
March 3, 2013 at 9:53 pm
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...
March 3, 2013 at 9:44 pm
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...
February 28, 2013 at 7:23 pm
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...
February 28, 2013 at 2:54 am
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....
February 27, 2013 at 9:06 pm
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).
February 27, 2013 at 9:02 pm
Viewing 15 posts - 46 through 60 (of 223 total)