Page 1 of 1

MysQL & MS-SQL conversion

Posted: Mon Aug 08, 2005 1:27 pm
by quadoc
I've the following statement in MySql, could someone tell me how to convert that to a MS-SQL statement. Thanks...

Code: Select all

$showtickets = mysql_query("SELECT * FROM `tickets` WHERE open='$tixstatus' AND dep='$dep' $s_sort LIMIT ".$i_limit_start.", ".$g_limit ." ");

Posted: Mon Aug 08, 2005 1:38 pm
by Burrito
unforutnately mssql doesn't have a limit function:

you'll probably have to do something like this:

Code: Select all

$showtickets = mssql_query("SELECT TOP ".$g_limit." * FROM tickets");
then skip through your first $i_limit_start value.

or you could use a subquery to select TOP $g_limit and subquery out the ones before it....

Posted: Mon Aug 08, 2005 1:38 pm
by feyd
google: limit mysql mssql

you'll find all the bits in the next few links, usually..

Posted: Mon Aug 08, 2005 1:41 pm
by quadoc
Thanks for the tips guys... :)