Selecting a specific number of rows in TSQL

Filed Under (SQL) by manatarms on 25-12-2007

Tagged Under :

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:

1
SET @@ROWCOUNT = # of Rows To Select

Then perform the select statement and your in business!

Insert Multiple TSQL Rows

Filed Under (SQL) by manatarms on 04-12-2007

Tagged Under :

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

1
2
3
4
INSERT INTO TableName(COLUMNS...)
SELECT Val1, Val2...
UNION ALL
SELECT Val1, Val2...

etc.

Upload Large Files in ASP.NET

Filed Under (Web Development) by manatarms on 03-12-2007

Tagged Under : ,

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

1
<httpRuntime maxRequestLength="2000000"/>