Create Backup table Instantly :
The Following query automatically creates a Table with name "Table_Backup" and Insert all the rows of "Table_Old" into "Table_Backup"
Example :
SELECT * INTO Table_Backup FROM Table_Old
SELECT * INTO Table_Backup FROM Table_Old
link rel="stylesheet" type="text/css" href="style.css"
body { background-color: #FFFFF0; font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #00008B; } a { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: Blue; text-decoration: underline; } a:hover { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: Red; background-color: Green; } h1 { font-family: Arial, Verdana, sans-serif; font-size: 32px; color: blue; } table { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #00008B; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; }
link rel="stylesheet" type="text/css" href="test.css"
/* Declaring variables */ DECLARE @Var1 AS int, @Var2 AS int /* The same can be done using SET, but two SET statements are needed */ SET @Var1 = 1 SET @Var2 = 2 /* Initializing two variables at once */ SELECT @Var1 = 1, @Var2 = 2
SET @Var1 = 1, @Var2 = 2 Msg 102, Level 15, State 1, Line 10 Incorrect syntax near ','.
/* Returns NULL */ DECLARE @Title varchar(80) --SET @Title = 'Not Found' SET @Title = ( SELECT error FROM SysMessages WHERE Description = 'Invalid Description' ) SELECT @Title GO /* Returns the string literal 'Not Found' */ DECLARE @Title varchar(80) SET @Title = 'Not Found' SELECT @Title = error FROM SysMessages WHERE Description = 'Invalid Description' SELECT @Title GO
/* Consider the following table with two rows */ SET NOCOUNT ON CREATE TABLE #Table (i int, j varchar(10)) INSERT INTO #Table (i, j) VALUES (1, 'Sunday') INSERT INTO #Table (i, j) VALUES (1, 'Monday') GO /* Following SELECT will return two rows, but the variable gets its value from one of those rows, without an error. you will never know that two rows existed for the condition, WHERE i = 1 */ DECLARE @j varchar(10) SELECT @j = j FROM #Table WHERE i = 1 SELECT @j GO /* If you rewrite the same query, but use SET instead, for variable initialization, you will see the following error */ DECLARE @j varchar(10) SET @j = (SELECT j FROM #Table WHERE i = 1) SELECT @j Msg 512, Level 16, State 1, Line 4 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
DECLARE @j varchar(10) SELECT @j = (SELECT j FROM #Table WHERE i = 1) SELECT @j
SELECT @Var1 = @Var1 + 1, @Var2 = @Var2 - 1, @CNT = @CNT + 1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim UCDynamic As Control 'WebUserControl.ascx : User Control path UCDynamic = LoadControl("WebUserControl.ascx") PlaceHolder1.Controls.Add(UCDynamic) End Sub
IF OBJECTPROPERTY( OBJECT_ID( '[dbo].[Employee]' ), 'TableHasPrimaryKey' ) = 1 PRINT '[dbo].[Employee] table has a primary key.' ELSE PRINT '[dbo].[Employee] table has no primary key.'
// Declaring valid date character, minimum year and maximum year var dtCh= "/"; var minYear=1900; var maxYear=2100; function isInteger(s) { var i; for (i = 0; i <> { // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag) { var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i <> { var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year) { // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr) { var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strMonth=dtStr.substring(0,pos1) var strDay=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1) { alert("The date format should be : mm/dd/yyyy") return false } if (strMonth.length<1>12) { alert("Please enter a valid month") return false } if (strDay.length<1>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]) { alert("Please enter a valid day") return false } if (strYear.length != 4 || year==0 || yearmaxYear) { alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear) return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false) { alert("Please enter a valid date") return false } return true } function ValidateForm() { var dt; dt=document.getElementById('txtDate'); if (isDate(dt.value)==false) { dt.focus() return false } return true }
Partial Class SelectWeekEnds Inherits System.Web.UI.Page Dim btnclick As Boolean = False Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender Dim ctl As New CheckBox ctl.ID = "chk" & e.Day.Date.ToString.Substring(0, 10) If btnclick = True Then If CInt(e.Day.Date.DayOfWeek) = 0 Or CInt(e.Day.Date.DayOfWeek) = 6 Then ctl.Checked = True End If End If e.Cell.Controls.Add(ctl) End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click btnclick = True End Sub End Class
Partial Class SelectWeekEnds Inherits System.Web.UI.Page Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender Dim ctl As New CheckBox ctl.ID = "chk" & e.Day.Date.ToString.Substring(0, 10) e.Cell.Controls.Add(ctl) End Sub End Class
function isNumberEvt(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if ((charCode > 31 && charCode <> 57 && charCode <> 90 && charCode <> 122)) return false; return true; }
asp:textbox id="TextBox1" onkeypress="return isNumberEvt(event)" runat="server" width="238px"