Quantcast
Channel: SQL Server Teacher
Browsing all 26 articles
Browse latest View live

How to Get the First and Last Day of any Month in SQL Server

Hi, Use to the below query to get the first and last day of any month in SQL Server. DECLARE @Month int, @Year int, @First datetime, @Last datetimeset @Month = 4set @Year = 2012select @First...

View Article


List all the SQL Agent Jobs and its Steps

Hi, Please find the below query to get all the SQL Agent Jobs and its Steps. SELECT J.NAME AS'JOB NAME',S.STEP_ID AS'STEP',S.STEP_NAME AS'STEP NAME',S.COMMAND AS'QUERY',DATABASE_NAME as'Database'FROM...

View Article


Limitations of SQL Server 2008 R2 Express Edition

Hi, Below are the limitations of SQL Server 2008 R2 Express Edition. 1.       Maximum database size of 10 GB per database in SQL Server 2008 R2 (4 GB for SQL Server Express 2008 and earlier; compared...

View Article

How to get the Min and Max Date Modified files in a Large Directory

Hi All, Sometimes we came to a situation to find the min and max dates in a file directory which is very large and will hang up the server if it is opened in windows explorer. Powershell will help us...

View Article

Query to find the size of the Database Files and its Free Space

Hi, Please use the below query to find the Size of the Database Files and its free space. select      name    ,filename    ,convert(decimal(12,2),round(a.size/128.000,2))as FileSizeMB...

View Article


SQL Server - Difference between Functions and Stored Procedures

Hi, Below are the basic differences between Functions and Stored Procedures in SQL Server. S#FunctionsStored Procedures1Functions must return a valueProcedures can return 0 or n values2Procedures...

View Article

Image may be NSFW.
Clik here to view.

An error occurred while executing batch. Error message is: The directory name...

Hi,I logged into one of the production server and executed few simple select statements. I received the following error message.An error occurred while executing batch. Error message is: The directory...

View Article

Msg 8115, Level 16, State 2, Line 1 - Arithmetic overflow error converting...

Hi,Error:Msg 8115, Level 16, State 2, Line 1Arithmetic overflow error converting expression to data type int.The statement has been terminated.Cause: This error occurs when a column exceed the...

View Article


SQL Server 2012 - Data Types

Hi, Below is the list of Data Types available in SQL Server 2012.S#Data Type1bigint2binary(50)3bit4char(10)5date6datetime7datetime2(7)8datetimeoffset(7)9decimal(18,...

View Article


Image may be NSFW.
Clik here to view.

Cannot set a credential for principal 'sa'. (Microsoft SQL Server, Error: 15535)

Hi, Error: TITLE: Microsoft SQL Server Management Studio------------------------------Alter failed for Login 'sa'.  (Microsoft.SqlServer.Smo)For help, click:...

View Article

List of SQL Server Data Types - All Versions

Hi,Below is the list of data types across all MS SQL Server Versions.S#Data TypeSQL Server 2000SQL Server 2005SQL Server 2008SQL Server...

View Article

How to insert values in an identity column - SQL Server

Hi,The following example explains how to insert values in an identity column.Exercise:-- Create a table for testing the identity insert.Createtable Testing(LogNo intidentity (1,1),Emp_No...

View Article

Image may be NSFW.
Clik here to view.

Filter Performance Counters

Hi Friends,Yesterday I attended a free session conducted by SQL Bangalore UG Team (https://www.facebook.com/SQLBangalore), in which Vinod Kumar (@vinodk_sql) a MTC Architect given few Office Tips &...

View Article


How to resize a window to specific size

Today I just tried to record my screen window for a demonstration purpose. My screen size is 1366 X 768. But i do not want to record my complete screen but only a particular window with a specific size...

View Article

RANK() Function in SQL Server

Hi,RANK() function returns the rank of each row within the partition of a result set.Let’s discuss this briefly with the below example.The following example calculates the ranks of the students in the...

View Article


Image may be NSFW.
Clik here to view.

Difference between RANK() AND DENSE_RANK() functions in SQL Server

Hi, RANK() function returns the rank of each row within the partition of a result set. DENSE_RANK() function returns the rank of rows within the partition of a result set, without any gaps in the...

View Article

Tip to easily view the structure of the table

Hi,During database development we need to verify the table structure most frequently. To improve productivity, SSMS is having SPS and shortcut keys to achieve this in few seconds. Tip 1:Run the...

View Article


Image may be NSFW.
Clik here to view.

(Ctrl + R) was pressed Waiting for second key of chord… – SSMS 2012

Hi,Question:In SQL Server Management Studio 2008 and 2008 R2, the shortcut key Ctrl + R will hide and display the result pane. It was very helpful to improve the productivity.However in SSMS 2012 when...

View Article

How you’ll troubleshoot a slow running query? – Interview Question

Hi Guys,Today i attended a telephonic interview. The interviewer asked me, How you’ll troubleshoot a slow running query? Please find below our conversation. If you’ve any better answer than this,...

View Article

XACT_ABORT ON / OFF

Hi, I’ve been going through the below model question for MCSA (Microsoft Certified Solutions Associate) 70-461 exam. This question is frequently asked in all the exams. Let’s discuss this so that it...

View Article
Browsing all 26 articles
Browse latest View live