user1166981 user1166981 - 1 year ago 123
SQL Question

Is there an equivalent in SQL as microtime() for PHP?

I assumed there would be a query you can make in SQL for this, microtime() is derived from the server environment so I hoped there would be a 'like-for-like' in SQL, but I can't see it. Im using MSSQL but would be interested in other dbs too.

Answer Source

Assuming MySQL, can you try something like this:


Here is the SQL Fiddle which also shows the use of MySQLs MicroSecond method.


Since you're using SQL Server, can this work:


And the SQL Fiddle.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download