This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UPDATE TableName | |
| SET DBTextField = REPLACE(CAST(DBTextField AS varchar(MAX)), 'SearchText', 'ReplaceText') | |
| FROM TableName | |
| WHERE CHARINDEX('SearchText', CAST(DBTextField as varchar(MAX))) > 0 | |
| Example: | |
| UPDATE [database].[dbo].[table] | |
| SET [column_name] = REPLACE(CAST([column_name] AS varchar(MAX)), 'OLD_WORD', 'NEW_WORD') | |
| FROM [database].[dbo].[table] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From: http://www.csharp-examples.net/string-format-datetime/ | |
| String Format for DateTime [C#] | |
| This example shows how to format DateTime using String.Format method. All formatting can be done also using DateTime.ToString method. | |
| Custom DateTime Formatting | |
| There are following custom format specifiers y (year), M (month), d (day), h (hour 12), H (hour 24), m (minute), s (second), f (second fraction), F (second fraction, trailing zeroes are trimmed), t (P.M or A.M) and z (time zone). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AjaxJsonPostCall = function (fullUrl, dataObj, callbackFunction) { | |
| $.ajax({ | |
| type: 'post', | |
| url: fullUrl, | |
| data: JSON.stringify(dataObj), | |
| dataType: 'json', | |
| cache: false, | |
| success: function (data) { callbackFunction(GetJson(data)); }, | |
| error: function (XMLHttpRequest, textStatus, errorThrown) { | |
| console.log("error :" + XMLHttpRequest.responseText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://gitstack.com/how-to-migrate-from-tfs-to-git/ | |
| http://stackoverflow.com/questions/19548659/migrate-from-tfs-to-git-on-visualstudio-com/19550144 | |
| git-tfs clone --username=mumair85 --password=xxxx https://mumair85.visualstudio.com/DefaultCollection $/uGen | |
| After that clone the new repository or Push an existing repository | |
| From Visual Studio | |
| You can Push a repository after connecting with Team Explorer and adding the Git repo to your list of Local Git Repositories. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public string TimespanInWords(DateTime oDtTo, DateTime oDtFrom) | |
| { | |
| TimeSpan oTs = oDtTo >= oDtFrom ? oDtTo - oDtFrom : oDtFrom - oDtTo; | |
| if (oTs.TotalSeconds < 30) | |
| return "less than a minute"; | |
| if (oTs.TotalSeconds < 90) | |
| return "1 minute"; | |
| if (oTs.TotalSeconds < 44 * 60 + 30) | |
| return (int)oTs.TotalMinutes + " minutes"; | |
| if (oTs < new TimeSpan(0, 89, 30)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string ToReadableString(this TimeSpan span) | |
| { | |
| string formatted = string.Format("{0}{1}{2}{3}", | |
| span.Duration().Days > 0 ? string.Format("{0:0} day{1}, ", span.Days, span.Days == 1 ? String.Empty : "s") : string.Empty, | |
| span.Duration().Hours > 0 ? string.Format("{0:0} hour{1}, ", span.Hours, span.Hours == 1 ? String.Empty : "s") : string.Empty, | |
| span.Duration().Minutes > 0 ? string.Format("{0:0} minute{1}, ", span.Minutes, span.Minutes == 1 ? String.Empty : "s") : string.Empty, | |
| span.Duration().Seconds > 0 ? string.Format("{0:0} second{1}", span.Seconds, span.Seconds == 1 ? String.Empty : "s") : string.Empty); | |
| if (formatted.EndsWith(", ")) formatted = formatted.Substring(0, formatted.Length - 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USE DATABASENAME | |
| GO | |
| SELECT IDENT_CURRENT('TABLENAME') + IDENT_INCR('TABLENAME') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Simple table grid style:*/ | |
| table.gridtable { | |
| font-family: verdana,arial,sans-serif; | |
| font-size:11px; | |
| color:#333333; | |
| border-width: 1px; | |
| border-color: #666666; | |
| border-collapse: collapse; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USE master | |
| GO | |
| ALTER DATABASE YourDatabaseName | |
| SET OFFLINE WITH ROLLBACK IMMEDIATE | |
| GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * | |
| FROM TABLE | |
| where datetime >= Convert(datetime, '2014-01-17 00:00:01', 120) | |
| AND datetime <= Convert(datetime, '2014-01-17 23:59:01', 120) |