TODO Reading
http://www.sqlservercentral.com/blogs/sql_coach/2010/07/29/poor-little-misunderstood-views/
Showing posts with label t-sql. Show all posts
Showing posts with label t-sql. Show all posts
Aug 11, 2015
Sep 4, 2014
MS SQL Can't drop user since it is DBO
You are trying to drop user from Security/Users and get error something like "Can't drop user who owns schema ..."
Useful link:
http://www.mssqltips.com/sqlservertip/2620/steps-to-drop-an-orphan-sql-server-user-when-it-owns-a-schema-or-role/
Further actions were needed for me.
Go to Schemas, find schema in question ( e.g. db_owner) -> Properties -> change Schema owner to "dbo".
This will release user in question and you should be able to drop it.
Useful link:
http://www.mssqltips.com/sqlservertip/2620/steps-to-drop-an-orphan-sql-server-user-when-it-owns-a-schema-or-role/
Further actions were needed for me.
Go to Schemas, find schema in question ( e.g. db_owner) -> Properties -> change Schema owner to "dbo".
This will release user in question and you should be able to drop it.
Feb 5, 2013
Representing proper T-SQL string of .NET float & double types
You build a dynamic T-SQL statement in C#.
There is .NET double variable.
You need correct culture independent version of your double variable.
In many European cultures decimal separator is comma and not dot.
So when you pick double value from app.GUI defined by client culture it will be:
1,01
If you inject this in T-SQL statement it is of course invalid.
To workaround this use InvariantCulture.
var result = 1E-1;
string MysqlDoubleString = Convert.ToString(result, System.Globalization.CultureInfo.InvariantCulture);
Please note that above scenario of building dynamic T-SQL is very risky and unsecure since it is prone to SQL injection attacks.
Always use classic ADO.NET SQLParameter class instead.
There is .NET double variable.
You need correct culture independent version of your double variable.
In many European cultures decimal separator is comma and not dot.
So when you pick double value from app.GUI defined by client culture it will be:
1,01
If you inject this in T-SQL statement it is of course invalid.
To workaround this use InvariantCulture.
var result = 1E-1;
string MysqlDoubleString = Convert.ToString(result, System.Globalization.CultureInfo.InvariantCulture);
Please note that above scenario of building dynamic T-SQL is very risky and unsecure since it is prone to SQL injection attacks.
Always use classic ADO.NET SQLParameter class instead.
Subscribe to:
Posts (Atom)