Archive

Archive for December, 2007

Selecting a specific number of rows in TSQL

December 25, 2007 Leave a comment

The other day I had the need to select an exact number of rows in a TSQL stored procedure. The circumstances constrained me in multiple ways and I just so happened to come across this little gem of a trick for selecting a set number of rows without using TOP.

All one must do is use the following assigment:

SET @@ROWCOUNT = # of Rows To Select

Then perform the select statement and your in business!

Advertisements
Categories: Uncategorized

Insert Multiple TSQL Rows

December 4, 2007 Leave a comment

The only easy way to insert multiple records in TSQL (and it’s quick!):

INSERT INTO TableName(Columns…)
SELECT Val1, Val2…
UNION ALL
SELECT Val1, Val2…

etc.

Categories: SQL, TSQL

Upload Large Files in ASP.NET

December 3, 2007 Leave a comment

Here’s the simple solution to uploading large files in ASP .net.

Add a new key in the web.config. The fileSize (maxRequestLength) is in kilobytes with a default size of 4.

The key to add is

<httpRuntime maxRequestLength=”2000000″/>

Categories: .NET, ASP, File