Quantcast
Channel: SQL Server Teacher
Browsing latest articles
Browse All 26 View Live

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

Image may be NSFW.
Clik here to view.

Difference between LEN() and DATALENGTH(), VARCHAR() AND NVARCHAR()

Hi,Yesterday one of my colleague asked me a question. He told that he created a table with 2 columns Name and Name1 with datatypes varchar(20) and nVarchar(20). He is entering the same values in both...

View Article

Image may be NSFW.
Clik here to view.

SQL Server - How to get the list of Hard Disk and Free Space on SQL DB Server

SQL Server - How to get the list of Hard Disk and Free Space on SQL DB ServerThe below Stored Procedure will help to get the list of Hard Disk and its available free space on SQL DB...

View Article


Generate Random Passwords – SQL Server

Hi,Below is the simple method to generate random passwords.Query:selectsubstring(replace(cast(newid()asvarchar(50)),'-',''),1,10)The above query will generate random 10 digit passwords. The number can...

View Article


Image may be NSFW.
Clik here to view.

“Consistency validation for SQL Server registry keys” failed. – SQL Server...

Hi,The below error occurs when we install SQL Server 2012.Rule “Consistency validation for SQL Server registry keys” failed. The SQL Server registry keys from a prior installation cannot be modified....

View Article

How to insert into a table which contains only one IDENTITY column

Hi,Question:I have a table with only one column. The column is of smallint datatype and is specified as identity. How to insert into that table?Answer:Let’s discuss this with a example.Create a table...

View Article

Image may be NSFW.
Clik here to view.

Cluster is not recognized as an internal or external command, operable...

Hi,Error Message:Cluster is not recognized as an internal or external command, operable program or batch fileSolution:              1. Go to Server Manager -> Manage -> Add Roles and Features...

View Article

Browsing latest articles
Browse All 26 View Live




Latest Images