Posts

Showing posts from October, 2009

Freebooks sites

You can find really helpful Microsoft .net (ASP.Net, VB.Net, c#.net and AJAX) books pdf at the following link... http://books-pdf.blogspot.com/search/label/ASP.Net http://books-pdf.blogspot.com http://microsoft-java-ebooks.blogspot.com http://freebooksandmagazines.blogspot.com http://www.ebooksboard.com/ http://muralikrishna542.blogspot.com

how to find a text in the Stored Procedure

ALTER PROCEDURE [dbo].[snproc_find_text_in_sp] @StringToSearch varchar(MAX) AS BEGIN SET @StringToSearch = '%' +@StringToSearch + '%' SELECT Distinct SO.Name FROM sysobjects SO (NOLOCK) INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID AND SO.Type = 'P' AND SC.Text LIKE @stringtosearch ORDER BY SO.Name END

Please refer to following update query to recently executed T-SQL query on database.

--Please refer to following update query to recently executed T-SQL query on database. --USE Master SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query] FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest ORDER BY deqs.last_execution_time DESC

Good collection of .Net and Programming Resources

Good collection of .Net and Programming Resources Below is a main section, covering most of the programming languages http://www.oneqresources.com/tutorial.php Few other resources in sub-sections are: http://www.oneqresources.com/csharptutorials.php http://www.oneqresources.com/cpptutor.php http://www.oneqresources.com/dot-net-downloads.php

Rows to Columns Using Coalese

view plain copy to clipboard print ? State (Tablename) ----- City (Columnname) ----- Chennai Madurai Coimbatore declare @retstr varchar (8000) select Top 5 @retstr = COALESCE (@retstr + ';' , '' ) + City from State print @retstr

Pagination in Sql Server 2005

Method 1: DECLARE @rowsPerPage int , @pageNum int , @startRow int , @endRow int SET @rowsPerPage = 10 SET @pageNum = 3 SET @startRow = ((@pageNum- 1) * @rowsPerPage)+1 SET @endRow = @startRow + @rowsPerPage -1 SELECT * FROM ( SELECT row_number() OVER ( ORDER BY id) as resultNum, id FROM myTable ) as numberResults WHERE resultNum BETWEEN @startRow AND @endRow Method2: SET @rowsPerPage = 10 SET @pageNum = 3 With SQLPaging As ( Select Top (@rowsPerPage * @pageNum) ROW_NUMBER() OVER ( ORDER BY id) as resultNum, id FROM myTable ) select * from SQLPaging where resultNum > ((@pageNum - 1) * @rowsPerPage)

Find the Text In the StoredProcedure

DECLARE @SEARCHSTRING VARCHAR (255) SELECT @SEARCHSTRING = 'MyTable' SELECT DISTINCT sysobjects .name FROM sysobjects , syscomments WHERE sysobjects .id = syscomments .id -- look for stored procs only AND sysobjects .type = 'P' AND sysobjects .category = 0 -- what you are looking for, what you're looking in AND CHARINDEX (@SEARCHSTRING, syscomments . text )>0

Open DataSource : Excel

select mi . SKU , mi. CasesPerPallet , cp . CasesPerPallet as SandrasCasesPerPallet from ii_masteritem mi join OPENDATASOURCE ( 'Microsoft.Jet.OLEDB.4.0' , 'Data Source=d:\data\cspallet.xls;Extended Properties=Excel 8.0' )... Sheet1$ cp on cp . SKU = mi . SKU where mi.CasePerPallet cp . CasesPerPallet

Recommended blog for C# 3.0 and functional programming

Recommended blog for C# 3.0 and functional programming I found the following blog post on programming.reddit.com: http://www.atrevido.net/blog/2007/09/05/C+30+And+LINQ+Misunderstandings.aspx I also recommend these blogs on functional programming in C# 3.0 by the same author: http://www.atrevido.net/blog/2007/08/12/Practical+Functional+C+Part+I.aspx http://www.atrevido.net/blog/2007/08/13/Practical+Functional+C+Part+II.aspx http://www.atrevido.net/blog/2007/08/16/Practical+Functional+C+Part+III+Loops+Are+Evil.aspx http://www.atrevido.net/blog/2007/08/29/Practical+Functional+C+Part+IV+Think+In+ResultSets.aspx This is really good stuff that any C# programmer can benefit from

To find the Month Name and Day

select datename(month,GETDATE()) select datename(dw,GETDATE()) select datepart(dw,GETDATE())

Reading andand Writing XML Data

Reading & Writing XML Data This post covers how to read and write XML data using XmlReader and XmlWriter classes provided by .NET framework. To get the Overview of XML support in .NET Framework pls read following post . Classes XmlReader & XmlWriter provide support for forward-only, read-only & write-only and non-cached way of reading & writing XML data. For reading the data, XmlReader provides the support for traversing through node, data, attributes, etc. XmlReaderSettings attached to XmlReader instance controls the behaviour of XmlReader like setting the validation type, setting event handler for validation failure etc. XmlSchemaSet can be used to specify the schema file to be used in case validation is of type Schema. For writing XML, XmlWriter provide the support for writing xml data to file in forward-only manner. XmlWriterSettings controls the behaviour of XmlWriter class like Indentation and Indentation characters to be used. Below sample demonst...

Tamil Dictionary

http://www.lanka.info/dictionary/EnglishToSinhala.jsp

Free books sites

http://free-ebooks-for-u.blogspot.com/ http://www.netbks.com/ http://knowfree.net http://booktraining.net http://vndownload.org http://www.free-ebook-download.net/ http://avaxhome.ws/

how to select records randomly in SQL

select top 3 * from tb_mytable order by newid() select top 3 * from tb_mytable order by Rand()

Generic

using System; using System.Collections.Generic; class Test { static void Main( string [] args ) { Test t = new Test(); int [] integerArray = {1,2,3,4,5,6}; char [] characterArray = { 'J', 'O', 'Y', 'D', 'I','P' }; double [] doubleArray = {0.1,0.2,0.3,0.4,0.5,0.6}; Console.WriteLine( "Displaying the contents of the integer array:--" ); t.Display(integerArray); Console.WriteLine( "Displaying the contents of the character array:--" ); t.Display(characterArray); Console.WriteLine( "Displaying the contents of the double array:--" ); t.Display(doubleArray); } public void Display ( GenericArray[] array ) { for ( int i = 0; i Console.WriteLine(array[i]); } }

SQL Schema Binding

CREATE FUNCTION dbo . ComputeNum ( @i int ) RETURNS int WITH SCHEMABINDING BEGIN RETURN @i * 2 + 50 END In SQL 2005 it improves the performance.

SQL Amazing

if(0='') print 'yes' else print 'no' Result is yes The result would be 'Yes'. "When an operator combines two expressions of different data types, the rules for data type precedence specify that the data type with the lower precedence is converted to the data type with the higher precedence" ( http://msdn.microsoft.com/en-us/library/ms190309.aspx books on line). This means that the text is implicitly converted to integer with a value of 0.