How to Restore SQL Server 2005 Suspect Database
How to Restore SQL Server 2005 Suspect Database EXEC sp_resetstatus 'yourDBname';ALTERDATABASE yourDBname SET EMERGENCYDBCC checkdb('yourDBname')ALTERDATABASE yourDBname SET SINGLE_USER WITHROLLBACK...
View ArticleUsing Common Table Expressions
A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is...
View ArticleWhat is the logical query processing order of the various query clauses?
Logical query processing starts with the FROM clause, and then moves onto WHERE, GROUP BY, HAVING, SELECT, and ORDER BY.1. Evaluate the FROM Clause2. Filter Rows Based on the WHERE Clause3. Group Rows...
View ArticleDateTime,DateTime2 and DatetimeOffSet
Below are the differences. Use the time, date, datetime2 and datetimeoffset data types for designing new database. These types align with the SQL Standard. They are more portable. time, datetime2 and...
View ArticleFunctions That Get Date and Time Parts
FunctionSyntaxReturn valueReturn data typeDeterminismDATENAMEDATENAME ( datepart , date )Returns a character string that represents the specified datepart of the specified date.nvarchar...
View ArticleFunctions That Modify Date and Time Values
FunctionSyntaxReturn valueReturn data typeDeterminismDATEADDDATEADD (datepart , number , date )Returns a new datetime value by adding an interval to the specified datepart of the specified date.The...
View ArticleSQL SERVER String Functions
SUBSTRING FunctionThe SQL Server (Transact-SQL) SUBSTRING functions allows you to extract a substring from a string.EX. SELECT SUBSTRING('Techaray.com', 1, 4);Result: 'Tech'LEFTLEFT function starts...
View ArticleDerived Table V/S Sub Query V/S CTE
Derived TableSub QueryCTEderived tables are used in the FROM clause sub queries are used in the WHERE clause, but can also be used to select from one table and insert into another as we showed above A...
View ArticleRestrictions on Views
Views have a number of restrictions, such as the following: You cannot add an ORDER BY to the SELECT statement in a view. A view must appearjust like a table, and tables in a relational database...
View Article
More Pages to Explore .....