SQL Server2005 SynonymµÄʹÓÃ
--> Title : SQL Server2005 SynonymµÄʹÓÃ
--> Author : wufeng4552
--> Date : 2009-10-30
1.SynonymµÄ¸ÅÄî
¡¡ Synonym£¨Í¬Òå´Ê£©ÊÇSQL Server 2005µÄÐÂÌØÐÔ¡£¿ÉÒÔ¼òµ¥µÄÀí½âSynonymΪÆäËû對ÏóµÄ±ðÃû¡£
語·¨
CREATE SYNONYM [ schema_name_1. ] synonym_name FOR < object >
< object > :: =
{
[ server_name.[ database_name ] . [ schema_name_2 ].| database_name . [ schema_name_2 ].| schema_name_2. ] object_name
}
ÔÚ½¨Á¢Í¬義×Ö時£¬»ùµ×Îï¼þ²»ÐèÒª´æÔÚ¡£ÔÚ執ÐÐ階¶Î£¬SQL Server 會檢²é»ùµ×Îï¼þÊÇ·ñ´æÔÚ¡£
¸÷參數º義ÈçÏÂ:
schema_name_1 :Ö¸¶¨½¨Á¢Í¬義×ÖµÄ結構ÃèÊö¡£Èç¹ûδָ¶¨ schema£¬SQL Server 2005 會ʹÓÃĿǰʹÓÃÕßµÄ預設結構ÃèÊö¡£
synonym_name :這ÊÇÐÂͬ義×ÖµÄÃû稱¡£
server_name :這ÊÇ»ùµ×Îï¼þËùÔÚµÄËÅ·þÆ÷Ãû稱¡£
database_name :這ÊÇ»ùµ×Îï¼þËùÔÚµÄ資ÁÏ庫Ãû稱¡£Èç¹ûδָ¶¨ database_name£¬¾Í會ʹÓÃÄ¿Ç°資ÁÏ庫µÄÃû稱¡£
schema_name_2 :這ÊÇ»ùµ×Îï¼þµÄ結構ÃèÊöÃû稱¡£Èç¹ûδָ¶¨ schema_name£¬¾Í會ʹÓÃĿǰʹÓÃÕßµÄ預設結構ÃèÊö¡£
object_name :這ÊÇͬ義×Ö參¿¼µÄ»ùµ×Îï¼þÃû稱¡£
×¢:
ÈôҪʹÓøø¶¨¼Ü¹¹´´½¨Í¬Òå´Ê£¬Óû§±ØÐëÂú×ãÒÔÏÂÌõ¼þ£º
(1)ÓµÓд˼ܹ¹»ò¾ßÓÐ ALTER SCHEMA ȨÏÞÒÔ
(2)¾ßÓÐ CREATE SYNONYM ȨÏÞ¡£
(3)ÊÇ db_owner µÄ³ÉÔ±¡£
(4)ÊÇ db_ddladmin ¹Ì¶¨Êý¾Ý¿â½ÇÉ«µÄ³ÉÔ±
¿ÉÒÔΪÏÂÁжÔÏóÀàÐÍ´´½¨Í¬Òå´Ê£º
³ÌÐò¼¯ (CLR) ´æ´¢¹ý³Ì; ³ÌÐò¼¯ (CLR) ±íÖµº¯Êý
³ÌÐò¼¯ (CLR) ±êÁ¿º¯Êý; ³ÌÐò¼¯¾ÛºÏ (CLR) ¾ÛºÏº¯Êý
¸´ÖÆɸѡ¹ý³Ì; À©Õ¹´æ´¢¹ý³Ì
SQL ±êÁ¿º¯Êý;SQL ±íÖµº¯ÊýSQL ÄÚÁª±íÖµº¯Êý;
SQL ´æ´¢¹ý³ÌÊÓͼ; ±í(Óû§¶¨Òå)
2.SynonymµÄʵ¼ÊÓ¦ÓÃ
ÔÚÄãµÄ³ÌÐò·¢²¼µÄʱºò£¬ÄãͻȻ·¢ÏÖÄãÐèÒª¸ü¸Äij¸ö±íÃû£¬»ò×Ö¶ÎÃû¡£¶øÄãµÄ³ÌÐòÒѾ²»¿ÉÄÜÐ޸ġ£Õâʱ£¬Ôõô°ìÄØ£¿ÄǾʹ´½¨Synonym°É¡£µ±È»£¬ÔÚsql2000ʱ´ú£¬Äã¿ÉÒÔʹÓÃviewÀ´×öÕâ¸öÊÂÇ飬»òsprocs»òudfµÈ¡£µ«SynonymÓÐÆäËüËù²»ÄܵŦÄÜ£¬ÄǾÍÊÇ¿çÊý¾Ý¿â£¬¿ç·þÎñÆ÷¡£
-----------------------
Ïà¹ØÎĵµ£º
/*
--×÷ÓãºSQL SERVER²Ù×÷ACCESSµÄ´æ´¢¹ý³Ì
----------------------Ó÷¨-------------------------------
--´´½¨±ítc
exec sp_operate_access 'create table tc(id int)','c:\db1.mdb'
go
--ÔÚtc±í²åÈëÊý¾Ý
exec sp_operate_access 'insert into tc(id) values(1)','c:\db1.mdb'
go
--ɾ³ýtc±íµÄÊý¾Ý
exec sp_op ......
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWER()ºÍ ......
º¯Êý£º
XMLPARSE£º½âÎö×Ö·û»òÕß´ó¶ÔÏó¶þ½øÖÆÊý¾Ý£¬²úÉúXML
XMLSERIALIZE£º½«XMLֵת»»Îª×Ö·û»òÕß´ó¶ÔÏó¶þ½øÖÆÊý¾Ý
XMLVALIDATE£º¸ù¾ÝXML schemaУÑéXMLÖµµÄÓÐЧÐÔ
XMLEXISTS£º¼ì²âXQueryÊÇ·ñ·µ»Ø½á¹û£¨ÈçÓÉÒ»¸ö»ò¶à¸öÏîËù×é³ÉµÄÐòÁУ©
XMLQUERY£ºÖ´ÐÐÒ»¸öXQuery²¢ÒÔÒ»¸öÐòÁзµ»Ø½á¹û
XMLTABLE£ºÖ´ÐÐÒ»¸öXQuery£¬ÒÔ¹ØÏ ......
µÚÒ»ÖÖ£º
public void deleteUser(String byemail) {
Session session = getSession();
Transaction transaction = null;
String hql = "delete from Register where email=?
";
try {
transaction = session.beginTransactio ......
/*µ±Ö´ÐÐSQLʱ·¢ÏÖ²»ÄÜÁ¬½ÓÊý¾Ý¿â£¬ÏÈÖØÁ¬Ò»´Î*/
import java.io.FileInputStream;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
......