FirebirdSQL/最後篇 Firebird 綜合篇/FireBird&SQLServer
出自VFP Wiki
(修訂版本間差異)
小 (revert) |
|||
第109行: | 第109行: | ||
----- | ----- | ||
*[http://vfp.sunyear.com.tw/viewtopic.php?t=1604 Firebird-從SQL Server轉換到FirebirdSQL] | *[http://vfp.sunyear.com.tw/viewtopic.php?t=1604 Firebird-從SQL Server轉換到FirebirdSQL] | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- |
在2005年4月7日 (四) 07:04的最新修訂版本
'''[[== 文章未翻譯完成,請等待.. ==]]'''
目錄 |
如何從Microsoft SQL Server轉換到FirebirdSQL
Microsoft SQL Server適用的版本:MS SQL 6.5, MS SQL 7 and MS SQL 2000.
原文來自Marcelo Lopez Ruiz marcelo.lopezruiz@xlnet.com.ar
欄位型態對照表
MSSQL版本 | Data Type | Firebird | MSSQL definition and comments |
---|---|---|---|
6.5 | bigint | INT64 | 8-byte integer type. |
變數使用上的差異
For example, compare the following code snippets. /* This is MS SQL syntax. */ CREATE PROCEDURE my_procedure AS DECLARE @my_variable int SET @my_variable = 5 /* This is FireBird syntax. */ CREATE PROCEDURE my_procedure AS DECLARE VARIABLE my_variable int BEGIN my_variable = 5; END
迴圈使用上的差異
/* This is the original MS SQL statement, using the * traditional pubs database.*/ CREATE PROCEDURE list_states AS SELECT CASE state WHEN 'CA' THEN 'California' WHEN 'UT' THEN 'Utah' ELSE 'unknown' END FROM authors /* This is how it can be converted to Firebird. */ /* Isolate the CASE statement. */ CREATE PROCEDURE get_state_name ( state_code char(2) ) RETURNS ( state_name varchar(64) ) AS BEGIN IF (state_code = 'CA') THEN state_name = 'California'; ELSE IF (state_code = 'UT') THEN state_name = 'Utah'; ELSE state_name = 'unknown'; END /* This is the selectable stored procedure. */ CREATE PROCEDURE list_states RETURNS (state varchar(64)) AS DECLARE VARIABLE short_state CHAR(2); BEGIN FOR SELECT state FROM authors INTO :short_state DO BEGIN EXECUTE PROCEDURE get_state_name :short_state RETURNING_VALUES :state; SUSPEND; END END
WHILE 條件使用的差異
/* Firebird syntax. */ WHILE (i < 3) DO BEGIN i = i + 1; j = j * 2; END /* MS SQL syntax. */ WHILE (i < 3) BEGIN SET @i = @i + 1 SET @j = @j * 2 END