Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
loiter99
Starting Member
38 Posts |
Posted - 2005-04-27 : 12:23:23
|
| Hello, Is there a function that will allow me to add a row count to my queries? I have been dropping in a subquery to get the total count of rows, but I would like something cleaner.thanksJ |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-04-27 : 13:34:22
|
| SELECT * FROM MyTable WHERE MyColumn = '1'SELECT @@ROWCOUNT AS [MyRowCount]??Kristen |
 |
|
|
loiter99
Starting Member
38 Posts |
Posted - 2005-04-29 : 07:44:51
|
| Nope, that isn't it, but thanks for the reply.In QA, the row number is displayed next to each item. I want to get that row number in the actual query. So for example:Select *, [row number] from myTable99Is there a function or a way to put a looping variable that will increment in for [row number] ?thanks againJ |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-04-29 : 07:48:44
|
you can use a temp table for this. no such function in SQL server.use northwindselect identity(int, 1, 1) as id, customerid into #tempfrom ordersselect * from #temp drop table #temp Go with the flow & have fun! Else fight the flow |
 |
|
|
loiter99
Starting Member
38 Posts |
Posted - 2005-04-29 : 12:19:02
|
| AHHH, that is IT !!!!thx a millionJ |
 |
|
|
|
|
|