Interbase/FirebirdµÄSQLÓï·¨(ÊÕ²Ø)
Ò»¡¢·Öҳд·¨Ð¡Àý£º
SELECT FIRST 10 templateid,code,name from template ;
SELECT FIRST 10 SKIP 10 templateid,code,name from template ;
SELECT * from shop ROWS 1 TO 10; –firebird2.0Ö§³ÖÕâÖÖд·¨
¶þ¡¢ÏÔʾ±íÃûºÍ±í½á¹¹
SHOW TABLES;
SHOW TABLE tablename;
ËÄ¡¢¸üÐÂ×Ö¶Î×¢ÊÍ
UPDATE RDB$RELATION_FIELDS
SET RDB$DESCRIPTION = ‘ÃèÊöÐÅÏ¢’
WHERE (RDB$RELATION_NAME = ‘SHOP’)
AND (RDB$FIELD_NAME = ‘CREDIT_BUY’)
Îå¡¢ÏÔʾ×Ö¶Î×¢ÊÍ
SELECT RDB$FIELD_NAME,RDB$DESCRIPTION
from RDB$RELATION_FIELDS
WHERE (RDB$RELATION_NAME = ‘SHOP’)
AND (DB$FIELD_NAME = ‘CREDIT_BUY’)
Áù¡¢¸üбí×¢ÊÍ
UPDATE RDB$RELATIONS
SET RDB$DESCRIPTION = ‘ÃèÊöÐÅÏ¢’
WHERE RDB$RELATION_NAME = ‘TABLE_NAME’;
Æß¡¢²éѯËùÓеıíºÍÊÓͼ£¨°üÀ¨ÏµÍ³±íºÍϵͳÊÓͼ£©
SELECT RDB$RELATION_NAME
from RDB$RELATIONS;
°Ë¡¢²éѯËùÓеÄÓû§±íºÍÓû§ÊÓͼ
SELECT RDB$RELATION_NAME
from RDB$RELATIONS
WHERE RDB$SYSTEM_FLAG = 0;
¾Å¡¢²éѯËùÓеÄÓû§±í
SELECT RDB$RELATION_NAME
from RDB$RELATIONS
WHERE RDB$SYSTEM_FLAG = 0
AND RDB$VIEW_BLR IS NULL;
Ê®¡¢²éËùÓÐÓû§±í¡¢Óû§ÊÓͼËùÓÐ×ֶμ°Ïà¹Ø¶¨Òå
SELECT
a.RDB$RELATION_NAME,
b.RDB$FIELD_NAME,
b.RDB$FIELD_ID,
d.RDB$TYPE_NAME,
c.RDB$FIELD_LENGTH,
c.RDB$FIELD_SCALE
from RDB$RELATIONS a
INNER JOIN RDB$RELATION_FIELDS b
ON a.RDB$RELATION_NAME = b.RDB$RELATION_NAME
INNER JOIN RDB$FIELDS c
ON b.RDB$FIELD_SOURCE = c.RDB$FIELD_NAME
INNER JOIN RDB$TYPES d
ON c.RDB$FIELD_TYPE = d.RDB$TYPE
WHERE a.RDB$SYSTEM_FLAG = 0
AND d.RDB$FIELD_NAME = ‘RDB$FIELD_TYPE’
ORDER BY a.RDB$RELATION_NAME, b.RDB$FIELD_ID;
ʮһ¡¢²éÕÒij±íµÄËùÓÐ×ֶμ°Ïà¹Ø¶¨Òå
SELECT
A.RDB$FIELD_NAME,
B.RDB$FIELD_TYPE,
B.RDB$FIELD_LENGTH,
B.RDB$FIELD_PRECISION,
B.RDB$FIELD_SCALE
from RDB$RELATION_FIELDS A, RDB$FIELDS B
WHERE A.RDB$RELATION_NAME = ‘tablename’
AND A.RDB$FIELD_SOURCE = B.RDB$FIELD_NAME
ORDER BY A.RDB$FIELD_POS
Ïà¹ØÎĵµ£º
Ò»¡¢ÎÊÌâµÄÌá³ö
ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳÌύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½ ......
/*
2008 ѹËõ
ÐÐѹËõ
SQL SERVER 2008 Òý½øÁËÐÐѹËõÕâ¸öÐÂÌØÐÔ,Ö»ÓÐÆóÒµ°æ¾ßÓиÃÐÂÌØÐÔ.ÐÐѹËõÖ»ÐèÒª×îµÍµÄ¿Õ¼ä¶ÔÐÐÊý¾Ý½øÐÐѹËõ.ÐÐѹËõ¿ÉÒÔÔÚCREATEÒ»¸ö±í,Ë÷Òý»òÕßALTERÒ»¸ö±í,Ë÷ÒýµÄʱºò½øÐд´½¨.ѹËõ¿ÉÒÔÔÚ ......
--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver 'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '
--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--ÒÔºó²»Ô ......
USE StudentInfo
--=====================================================
--Author £ºyangjuncheng
--Create Date:2010.5.26
--Decription :¸ø±íÌí¼ÓÔ¼Êø£¨¿ÉÒÔÔÚ´´½¨±íʾֱ½ÓÌí¼Ó
-- Ò²¿ÉÒÔʹÓÃalter¹Ø¼ ......
sql server 2005 ¼òµ¥ÔËÓú¯Êý
1.null º¯Êý
Ó÷¨ÓëoracleÖÐnvl()ÀàËÆ£¬´¦Àíº¯ÊýΪisnull()£¬
ÀýÈ磺
select ename,sal+isnull(comm,0)
from emp
go
isnull(comm,0)µÄÓ÷¨ÊÇ£º commΪnull Ôò·µ»Ø0 ·ñÔòΪ commµÄÖµ¡£
2.V ......