22,810 reputation
33979
bio website blogs.msdn.com/b/sql_pfe_blog
location In the Ocean somewhere...
age
visits member for 3 years, 1 month
seen 10 hours ago

SQL Server Premier Field Engineer at Microsoft.

Twitter: @SQLife
Blog: http://blogs.msdn.com/b/sql_pfe_blog/
Email: sqlsalt [at] outlook [dot] com

Disclaimer
The views expressed on my posts on this site are mine alone and do not reflect the views of my company. All posts of mine are provided "AS IS" with no warranties, and confers no rights.

The following disclaimer applies to all code, scripts and demos available on my posts:

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.


1d
comment Fixing an error 9004 without taking the database offline
What is the state of the error? Do you have proper backups? Documents that should be read before continuing: support.microsoft.com/kb/2015753 blogs.msdn.com/b/sqlserverstorageengine/archive/2006/06/15/…
Jul
9
comment Transfer all tables from a schema to other schema
I edited my answer to show code to generate the ALTER statements.
Jul
9
comment Looking for a utility to move data between databases (prod to dev) SQL Server 2012
SSIS would still get my vote. You could always write your own script (with PowerShell, for example) but that's more work than necessary. That's a very simple task with SSIS.
Jul
9
comment Slow query execution using ODBC 32
If you are able to, feel free to put the output into your question for further review (most notably the query plan XML and the set_options attribute value).
Jul
9
comment Slow query execution using ODBC 32
My guess is that you're dealing with two different plans, perhaps caused by different statement set options. Here is a discovery query to look at the plans and other related information to get you started in the right direction: select * from sys.dm_exec_cached_plans cp cross apply sys.dm_exec_query_plan(cp.plan_handle) qp cross apply sys.dm_exec_sql_text(cp.plan_handle) st cross apply sys.dm_exec_plan_attributes(cp.plan_handle) pa where st.text not like '%dm_exec_cached_plans%' and st.text like '%VR_ISE_d3_Adressen%' and pa.attribute = 'set_options';
Jul
8
comment Dealing with large transaction logs in a cluster
What do you mean, "missing files"?
Jul
8
comment ALTER TABLE … SWITCHing from regular table to partitioned table fails
+1 on your question. You made it easy to repro and answer, due to DDL you put here. For that, thank you. I wish I could +10 questions like this.
Jul
4
comment tsql to find out sql server alias
I'm with Aaron on this one. Do this discovery outside of T-SQL.
Jun
27
comment Listener pointing to incorrect AlwaysOn Availability Group
Are Instance1 and Instance2 both replicas for both availability groups?
Jun
26
comment What does role db_owner allow
A member of the db_owner fixed database role will have SELECT, INSERT, UPDATE, and DELETE permissions on the database. Amongst many other permissions, but yes, that's correct.
Jun
25
comment Replicating a SQL Server database & Optimization
What exactly are your requirements? What do you have available to you? How much data loss can you sustain?
Jun
25
comment Print Order wise in c#
@AaronBertrand I'm completely missing the mark, then. The only sorting I see is T-SQL ORDER BY.
Jun
25
comment Print Order wise in c#
@AaronBertrand If order is required, you can either sort in the backend (T-SQL order by) or the front end (consuming code/application). I typically choose the former. The OP's outer ORDER BY is indeed effective. Looping through that result set with either a for or foreach loop will sequentially go through the data in the same order as retrieved.
Jun
25
comment Error while Installing SQL Server 2012
It seems as though setup simply can't retrieve the following file: 'D:\redist\VisualStudioShell\VS10sp1-KB983509-Pro.msp'. Are you sure that exists? Do this (PowerShell): Test-Path "D:\redist\VisualStudioShell\VS10sp1-KB983509-Pro.msp". What does that return? If True, then verify the security context that you're running setup.exe under has permissions to also access those files.
Jun
25
comment Print Order wise in c#
@AaronBertrand I see no problem with that. As long as the memory footprint of the desired data isn't large (and it's typically not, in my experience) I default to a DataAdapter as opposed to a DataReader. I prefer my connections to be short-lived. In my opinion, 1) Get data then 2) process data. Those shouldn't be mixed. Again, just my opinion. There are other times when a DataReader is best/required, though.
Jun
25
comment Print Order wise in c#
Can you show us what PersonalTrainerCheckboxData.ButID is? I'm guessing it is "Address", "Age", and "Name" for this data set output. In which case that is what you're sorting on, explaining why the rows are ordered like this.
Jun
24
comment Map a Login to a User that was Created Without Mapping to a Login
Ha! Good point. And definitely worth noting. I'll throw that as an edit in my answer.
Jun
24
comment Can I upgrade SQL Server 2008 R2 Standard to SQL Server 2014 Developer?
As a side note/question, why are you trying to go from a Standard edition instance to a Developer edition instance? That's not common.
Jun
19
comment Turning of Autogrowth for particular file
And that's not a bad or uncommon option at all.
Jun
19
comment Connection AlwaysOn AG Listener Problem
Then it might be time to get out your favorite network monitoring tool and see what is (and isn't) happening.