Tuesday, October 29, 2013
MSSQL select specific range of row
SQL2012
SELECT field
FROM table
ORDER BY field ASC
OFFSET 26 ROWS
FETCH NEXT 15 ROWS ONLY
SQL 2005 and above
SELECT field
FROM (SELECT ROW_NUMBER() OVER (ORDER BY table.field ASC) AS field_alias,
field FROM table) table_alias
WHERE table_alias.field_alias >= 10 and table_alias.field_alias <=30;
SQL 2000
SELECT TOP 25 *
FROM (
SELECT TOP 75 *
FROM table
ORDER BY field ASC
) table_alias
ORDER BY table_alias.field DESC;
Monday, September 9, 2013
Connect to MSSQL SERVER(Express) by using TCP/IP remotely
to allow MSSQL Express edition to connect by using TCP/IP remotely,
the TCP/IP protocol must be first enabled.
1. go to SQL Server Configuration Manager,
2. go to SQL Server Network Configuration
3. go to Protocols for SQLEXPRESS
4. Right click TCP/IP and select Enable.
5. After enabled, double click TCP/IP
6. go to IP Addresses tab,
7. Scroll until the end and look for IP All
8. Add 1433 to TCP Port
9. Go back to SQL Server Service,
10 right click SQL Server(SQLExpress) and Restart.
the TCP/IP protocol must be first enabled.
1. go to SQL Server Configuration Manager,
2. go to SQL Server Network Configuration
3. go to Protocols for SQLEXPRESS
4. Right click TCP/IP and select Enable.
5. After enabled, double click TCP/IP
6. go to IP Addresses tab,
7. Scroll until the end and look for IP All
8. Add 1433 to TCP Port
9. Go back to SQL Server Service,
10 right click SQL Server(SQLExpress) and Restart.
Subscribe to:
Posts (Atom)