EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'DBName'
GO
USE [master]
GO
ALTER DATABASE [DBName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
DROP DATABASE [DBName]
GO
Wednesday, July 11, 2012
Drop Database Script: For Reference
Labels:
Sql Server 2008
Monday, July 2, 2012
Alphanumeric Algorithm
Please check the following url that describes best about Alphanumeric algorithm. The best part of this article is, author Dave Koelle has created this algorithm in various languages.
http://www.davekoelle.com/alphanum.html
For the future reference i have copied the c# code to my site.
http://www.davekoelle.com/alphanum.html
For the future reference i have copied the c# code to my site.
/* * The Alphanum Algorithm is an improved sorting algorithm for strings * containing numbers. Instead of sorting numbers in ASCII order like * a standard sort, this algorithm sorts numbers in numeric order. * * The Alphanum Algorithm is discussed at http://www.DaveKoelle.com * * Based on the Java implementation of Dave Koelle's Alphanum algorithm. * Contributed by Jonathan Ruckwood* * Adapted by Dominik Hurnaus to * - correctly sort words where one word starts with another word * - have slightly better performance * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ using System; using System.Collections; using System.Text; /* * Please compare against the latest Java version at http://www.DaveKoelle.com * to see the most recent modifications */ namespace AlphanumComparator { public class AlphanumComparator : IComparer { private enum ChunkType {Alphanumeric, Numeric}; private bool InChunk(char ch, char otherCh) { ChunkType type = ChunkType.Alphanumeric; if (char.IsDigit(otherCh)) { type = ChunkType.Numeric; } if ((type == ChunkType.Alphanumeric && char.IsDigit(ch)) || (type == ChunkType.Numeric && !char.IsDigit(ch))) { return false; } return true; } public int Compare(object x, object y) { String s1 = x as string; String s2 = y as string; if (s1 == null || s2 == null) { return 0; } int thisMarker = 0, thisNumericChunk = 0; int thatMarker = 0, thatNumericChunk = 0; while ((thisMarker < s1.Length) || (thatMarker < s2.Length)) { if (thisMarker >= s1.Length) { return -1; } else if (thatMarker >= s2.Length) { return 1; } char thisCh = s1[thisMarker]; char thatCh = s2[thatMarker]; StringBuilder thisChunk = new StringBuilder(); StringBuilder thatChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length==0 ||InChunk(thisCh, thisChunk[0]))) { thisChunk.Append(thisCh); thisMarker++; if (thisMarker < s1.Length) { thisCh = s1[thisMarker]; } } while ((thatMarker < s2.Length) && (thatChunk.Length==0 ||InChunk(thatCh, thatChunk[0]))) { thatChunk.Append(thatCh); thatMarker++; if (thatMarker < s2.Length) { thatCh = s2[thatMarker]; } } int result = 0; // If both chunks contain numeric characters, sort them numerically if (char.IsDigit(thisChunk[0]) && char.IsDigit(thatChunk[0])) { thisNumericChunk = Convert.ToInt32(thisChunk.ToString()); thatNumericChunk = Convert.ToInt32(thatChunk.ToString()); if (thisNumericChunk < thatNumericChunk) { result = -1; } if (thisNumericChunk > thatNumericChunk) { result = 1; } } else { result = thisChunk.ToString().CompareTo(thatChunk.ToString()); } if (result != 0) { return result; } } return 0; } } }
Labels:
C#.Net
Monday, June 18, 2012
Some useful .Net, C#, MVC - Free Webcast Sites
1. Gathering the best c# videos from the web.
http://csharptube.com/
2.
http://csharptube.com/
2.
Thursday, October 20, 2011
Enbale FileStream in Sql Server 2008 from Sql Server Management Studio
Use following command to enable filestream in Sql Server.
Use Master
Go
/*0 = FILESTREAM disabled
1 = FILESTREAM for TSQL enabled
2 = FILESTREAM for TSQL and WIN32 streaming enabled*/
EXEC sp_configure 'filestream access level', 2
Go
RECONFIGURE
Go
Use Master
Go
/*0 = FILESTREAM disabled
1 = FILESTREAM for TSQL enabled
2 = FILESTREAM for TSQL and WIN32 streaming enabled*/
EXEC sp_configure 'filestream access level', 2
Go
RECONFIGURE
Go
Labels:
Sql Server 2008
Monday, August 29, 2011
Resolved Creating Database Diagram In Sql Server 2008 Express
While creating database diagram in Sql Server 2008, we may get the following error.
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
We need to following steps to resolve this issue.
In SQL Server Management Studio do the following:
1. Right Click on your database, go to properties
2. Goto the Options Page
3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"
4. Goto the Files Page
5. Enter "sa" in the owner textbox.
6. press OK
Steps 2 and 3 are optional. With out these steps also I was able to create DB diagram in Sql Server 2008.
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
We need to following steps to resolve this issue.
In SQL Server Management Studio do the following:
1. Right Click on your database, go to properties
2. Goto the Options Page
3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"
4. Goto the Files Page
5. Enter "sa" in the owner textbox.
6. press OK
Steps 2 and 3 are optional. With out these steps also I was able to create DB diagram in Sql Server 2008.
Labels:
Sql Server 2008
Saturday, June 25, 2011
A stupid bug in IE, that killed our 10 hours.
A stupid bug in IE that killed our 10hours. I told our, that is 5 developers each 2 hours we spent to resolve a issue.
A stylesheet class, because of which IE 8, was automatically redirecting to compatibility mode.
The class is
#BKWords { margin-top: 8px; max-height: 75px; overflow:scroll; }
Above css will not work in IE 8 and will redirect/reload to compatibility mode.
This is an issue in IE8. If you give the style as max-height and overflow scroll, IE8 will redirect automatically to compatibility view. For this we have to give overflow as auto.
Reference:
http://stackoverflow.com/questions/7707/ie8-overflowauto-with-max-height
A stylesheet class, because of which IE 8, was automatically redirecting to compatibility mode.
The class is
#BKWords { margin-top: 8px; max-height: 75px; overflow:scroll; }
Above css will not work in IE 8 and will redirect/reload to compatibility mode.
This is an issue in IE8. If you give the style as max-height and overflow scroll, IE8 will redirect automatically to compatibility view. For this we have to give overflow as auto.
Reference:
http://stackoverflow.com/questions/7707/ie8-overflowauto-with-max-height
AnkhSVN add-on a nice Subversion Support for Visual Studio
As all we know SVN is a nice and free source safe tool.
Similarly I was searching a free add in to Integrate SVN and Visual Studio.
AnkhSVN is a nice add on for subversion integration for Visual Studio. Best part is its free. I have seen VisualSVN, but that is licensed. We can visit the following URL and download AnkhSVN.
http://ankhsvn.open.collab.net/
Similarly I was searching a free add in to Integrate SVN and Visual Studio.
AnkhSVN is a nice add on for subversion integration for Visual Studio. Best part is its free. I have seen VisualSVN, but that is licensed. We can visit the following URL and download AnkhSVN.
http://ankhsvn.open.collab.net/
Labels:
AnkhSVN
Subscribe to:
Posts (Atom)