SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Archives: July 2013

SQL Server – Import text file using xp_cmdshell

There are several options available to import data from external sources to SQL Server. Such as Import & Export Wizard, BULK INSERT command, SSIS and OPENROWSET.

Apart from this options you can also use xp_cmdshell to import text file to SQL Server. We need to utilize dos command TYPE for… Read more

0 comments, 901 reads

Posted in SQL and Me on 29 July 2013

SQL Server – Get values as DATETIME from sysjobhistory

This is a follow-up post on SQL Server – Check SQL Agent Job History using T-SQL.

SQL Server Agent stores SQL jobs history in sysjobhistory. It has two different columns for date and time, Run_Date and Run_Time. Since this is not available as DATETIME we cannot filter… Read more

0 comments, 664 reads

Posted in SQL and Me on 22 July 2013

SQL Server – SELECTing/Displaying Top N rows from a table

To SELECT only top N rows from a table we can use TOP clause in SELECT statement. Using TOP clause we can also specify percentage option.

For example, both of these statements are valid:

USE SqlAndMe



SELECT TOP 5 EmployeeId,FirstName,LastName

FROM   dbo.Table_Employees

GO Read more

0 comments, 778 reads

Posted in SQL and Me on 15 July 2013

SQL Server – How to change SQL Server ERRORLOG location

By default SQL Server ERRORLOG is stored in "C:\Program Files\Microsoft SQL Server\InstanceFolder\MSSQL\Log" folder. The ERRORLOG location is configured as a startup parameter for SQL Server Service.

To change the location of ERRORLOG you need to modify the startup parameter -e.

For example, if you need to move logs to C:\Logs\… Read more

3 comments, 4,014 reads

Posted in SQL and Me on 8 July 2013

SQL Server – How to connect to SQL Server when ‘sa’ account is disabled

If you have lost the password for sa account or does not have any administrative account and you are locked out of SQL Server you can still login to SQL Server as an Administrator using Local administrator account.


You can use any account which is part of local Administrators… Read more

6 comments, 4,017 reads

Posted in SQL and Me on 1 July 2013