Sql provide RowCount to Delete a Duplicate rows from a table which has no Primary key:1. In Sql2000 one can use rowcount while deleting duplicate rows2. In Sql2005 one can use rowcount and top while deleting duplicate rows3. But according to MicroSoft: Using SET ROWCOUNT will not affect DELETE, INSERT, and UPDATE statements in the
The only solution is to check the 29days of Feb for the year. Also, there are some rules which tells a year as ‘Leap year’ 1. It should divisible by 42. It should have 29days fo February To do achieve the same I prefer inbuilt function ‘datepart’, may be there are many other ways to
The following is the snapshot shhowing the output:
Sometimes, we people when doing a higher things had lost some basics from memories, the sam happened with me. Yesterday [May 28, 2008] my supervisor asked me a bit question – “How to retrieve column names using datareader?” I was junked that time and noticed that I have lost something from my memories of basics.
1. How to run a query on a remote SQL Server? Ans: To do the same use OPENROWSET:Syntax: SELECT * FROM OPENROWSET(‘SQLOLEDB’,REMOTE_SERVER_NAME’;’sa’;’password’,’SQL STATEMENT’)Example: Select * from OPENROWSET(‘SQLOLEDB’,’local’;’sa’;”,’Select * from employees’) 2.How can execute operating system comman from within SQL Server? Ans: The xp_cmdshell stored procedure helps to do the same.Example:EXEC MASTER..xp_cmdshell ‘Dir C:’ 3. If
The script is originally written by : Tim Ford One can attain the same with the use of two inbuild stored procedure master.sys.xp_dirtree and master.sys.xp_create_subdir USE Master;GOSET NOCOUNT ON — 1 – Variable declarationDECLARE @DBName sysnameDECLARE @DataPath nvarchar(500)DECLARE @LogPath nvarchar(500)DECLARE @DirTree TABLE (subdirectory nvarchar(255), depth INT) — 2 – Initialize variablesSET @DBName = ‘Foo’SET @DataPath
Exporting data from SQL Server to Excel can be achieved in a variety of ways: Data Transformation Services [DTS] SQL Server Integration Services [SSIS] Bulk Copy [BCP] Rest of above GUI operation there is another option available via the T-SQL language is the OPENROWSET command.This command can be called directly in any stored procedure, script