Posts

Showing posts from 2009

Difference between TOP clause in SQL Server 2000 and SQL Server 2005.

Difference between TOP clause in SQL Server 2000 and SQL Server 2005. Generally TOP clause is used to perform SELECT on top n results. This feature of TOP is extended in SQL Server 2005 so that we can also use expression apart from int, bigint and percent to perform query, also extended to be used in UPDATE and DELETE statements. In SQL Server 2000 syntax: select Top N [Percent] EX: select Top 10 * from TableName or select Top 10 Percent * from TableName n specifies how many rows are returned. If PERCENT is not specified, n is the number of rows to return. If PERCENT is specified, n is the percentage of the result set rows to return Drawbacks: We could not parametrize. It will work only for select statements. If we want to restrict the number of rows affected by a select at runtime, or restrict the rows affected by an update or delete you had to explicitly describe the rows using a join or where clause, or you could cheat a bit by using ROWCOUNT, like this set rowcount 10 delete from t...

Running .net Exe from network Path.

Hi, Some days back i was said find solution for running exe from mapped or network drive. As you may known you cannot run .net made exe from network drive as .net Framework requires secured network to run application.To overcome this issue i was given a task to make exe run from network path.Solution what i found after R&D is Microsoft has provided a Tools to make this possible.Tool Called Caspol.exe, This makes the path (URL) which is passed as parameter makes it Secured. To Run the tools you have first goto Command Prompt of .net Framework Path :- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 CasPol.exe -m -ag 1.2 -url file:\\SERVER\F\TEMP\DotnetApps\ * FullTrust This Command will make the SERVER\F\TEMP\DotnetApps as Secure. Will all exe file run securely from this path. Regards Switin

Disable All Trigger

Hi, Some days back i had to disable all the triggers in database.Some R&D and Web Search gave me the perfect solution. To Disable Trigger for the Table Disable Trigger MyDatabase.MyTable On MyDatabase Disable all the triggers for all servers: DISABLE Trigger ALL ON ALL SERVER To Enable Trigger for the Table or Server just replace Disable Keyword with enable Enable Trigger MyDatabase.MyTable On MyDatabase Regards Switin

Difference between Primary key Constraint and Unique key Constraint in SQL Server

hi, Difference between Primary key Constraint and Unique key Constraint in SQL Server. Unique Key Constraint:The column values should retain uniqueness.It allows null values in the column.It will create non-clustered index by default.Any number of unique constraints can be added to a table. Primary Key Constraint:Primary key will create column data uniqueness in the table. It Wont allow Null values.By default Primary key will create clustered index.Only one Primary key can be created for a table.Multiple columns can be consolidated to form a single primary key Regards Switin

SQL SERVER FOR XML PATH

hi, Today i was reading my mails found some interesting feature in sql server 2005 and 2008 FOR XML PATH . FOR XML Path can be used to generate XML Format data from SQL Queries. I used it for Concat String Value (CSV) For Column XML PATH Syntax Select STUFF( ( Select Top 10 ',' + AccountName From Mastccount Order by ID For XML PATH('') ) ,1,1,'') as CSV Output Switin,Jitesh,Rupesh,............................... Note :- Stuff is to Remove the Addition , which comes on the start of String--Concat process is done by For Greate stuff from MS. Find out more from http://msdn2.microsoft.com/en-us/library/ms345137.aspx http://sqljunkies.com/WebLog/mrys/archive/2004/02/19/1208.aspx

My first blog

Hello, This Switin Kotian, Software Developer by profession. Regards Switin Kotian