Posts

Auto generate change scripts in SQL Server Management Studio SSMS for tables

Image
Problem As a part of my best practices, I always save the T-SQL scripts used for creation and modification of objects in SQL Server. When creating and modifying tables using SQL Server Management Studio designer it is easy to right click in the designer and select "Generate Change Script...", but is there a way to automatically script the creation and/or modification of tables made through of SQL Server Management Studio (SSMS) designer?  This tip shows you an option that exists within SSMS to automatically generate these scripts for all table changes when using the table designer. Solution Within SQL Server Management Studio (SSMS) there is an option to automatically generate scripts for your changes done through the GUI.  The solution for this problem is provided in SSMS and works with both SQL Server 2005 and SQL Server 2008, but by default this option that we will discuss is disabled. To enable the option From the SSMS menus click on "Tools"  ...

Visual Studio 2008, 2010, 2011, 2012 Keyboard Shortcuts Keys

It is amazing that you can get around without using a mouse at all. Master the following Visual Studio shortcuts and your colleagues might stare at you with amazement. 1.    F5: Start your project in debug mode 2.    F7 & Shift-F7: Show the code windows & Show the designer window 3.    Alt-Enter: Show the properties panel for a selected object (this is general Windows shortcut that can be used on files and directories) 4.    F6 / Shift-F6 / Ctrl-Shift-B: Build solution / Build project / Build solution 5.    Shift-Alt-C: Add a new class to your project 6.    Ctrl-K + Ctrl-C: Comment a selected block of code 7.    Ctrl-K + Ctrl-U: Un-comment a selected block of code 8.    Ctrl-M + Ctrl-O / Ctrl-M + Ctrl-P: Collapse all code to definitions / Expand all code (stop collapsing) 9.    Ctrl-M + Ctrl+M: Expend or collapse a selected code fragment. T...

What is a trusted connection?

Net-Lib (The Microsoft SQL Server Network Library) is also able to support the impersonation of a logged in user's security context for protocols that support authenticated connections (called trusted connections). This allows Net-Lib to provide an integrated logon authentication mechanism via the use of Windows Authentication. Windows Authentication is not supported on Windows 98 or Windows Me.

how to subtract value at previous row from current row?

Table data is like....  ------------------------------ EmpID    Emp_Name    Salary ------------------------------- 1             Mark             4000 2             Twin              2000 3             Aleganja        3000 4             Peter             8000 ------------------------------- Method (1) ------------------------------------ -  select top 1 EmpID,SALARY from Employee  union  SELECT e1.EmpID,(e2.Salary - e1.Salary) AS SALARY FROM Employee e1  INNER JOIN ...

End Date should not be less than Start Date using jQuery Date Picker

set maxDate: '0d' if you want to set your range with current date. $(document).ready(function(){ $("#txtFromDate").datepicker({ maxDate: '0d', numberOfMonths: 2, onSelect: function(selected) { $("#txtToDate").datepicker("option","minDate", selected) } }); $("#txtToDate").datepicker({  maxDate: '0d', numberOfMonths: 2, onSelect: function(selected) { $("#txtFromDate").datepicker("option","maxDate", selected) } }); });

How can I get column names from a table in sql server?

SELECT [name] FROM syscolumns WHERE id = (SELECT id FROM sysobjects WHERE type = 'U' AND [Name] = 'Your Table Name')

C# Remove HTML/XML Tags

Removing HTML tags from strings Input: <p>The <b>dog</b> is <i>cute</i>.</p> Output: The dog is cute. Performance test for HTML removal HtmlRemoval.StripTagsRegex: 2404 ms HtmlRemoval.StripTagsRegexCompiled: 1366 ms HtmlRemoval.StripTagsCharArray: 287 ms [fastest] File length test for HTML removal File tested: Real-world HTML file File length before: 8085 chars HtmlRemoval.StripTagsRegex: 4382 chars HtmlRemoval.StripTagsRegexCompiled: 4382 chars HtmlRemoval.StripTagsCharArray: 4382 chars HtmlRemoval static class [C#] using System; using System.Text.RegularExpressions; /// <summary> /// Methods to remove HTML from strings. /// </summary> public static class HtmlRemoval { /// <summary> /// Remove HTML from string with Regex. /// </summary> public static string StripTagsRegex(string source) { return Regex.Replace(so...