FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Registration troubles (Users can't registrate (registration timeout))
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Registration troubles [message #165220 is a reply to message #165219] Thu, 12 May 2011 16:56 Go to previous messageGo to previous message
AlxChep is currently offline  AlxChep
Messages: 9
Registered: March 2011
Karma:
Junior Member
I am newbie in SQL, but after a cup of googlig I have find that build-in mysql functions could be import to other SQL-databases, here are some samples:

for PostgreSQL it could be done via adding:

CREATE OR REPLACE FUNCTION from_unixtime(integer) RETURNS timestamp AS '
SELECT
$1::abstime::timestamp without time zone AS result
' LANGUAGE 'SQL';

CREATE OR REPLACE FUNCTION unix_timestamp() RETURNS integer AS '
SELECT
ROUND(EXTRACT( EPOCH FROM abstime(now()) ))::int4 AS result;
' LANGUAGE 'SQL';

CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS integer AS '
SELECT
ROUND(EXTRACT( EPOCH FROM ABSTIME($1) ))::int4 AS result;
' LANGUAGE 'SQL';


MS SQL:
CREATE FUNCTION UNIX_TIMESTAMP (
@ctimestamp datetime
)
RETURNS integer
AS
BEGIN
  /* Function body */
  declare @return integer

  SELECT @return = DATEDIFF(SECOND,{d '1970-01-01'}, @ctimestamp)

  return @return
END


CREATE FUNCTION FROM_UNIXTIME (
@timestamp integer
)
RETURNS datetime
AS
BEGIN
  /* Function body */
  DECLARE @return datetime

  SELECT @return = DATEADD(second, @timestamp,{d '1970-01-01'});

  RETURN @return
END



[Updated on: Thu, 12 May 2011 19:56]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Moderated forum?
Next Topic: Remove Registration Link
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 23:07:52 GMT 2024

Total time taken to generate the page: 0.04889 seconds