SQL¼ÓÃÜÊý¾Ý
ÍõÑà½Ü
ÔÚÍøÂçÉÏ·¢ËÍÊý¾Ý¶¼»á·¢ÉúһЩÑÏÖصݲȫÎÊÌ⣬ÍøÂç×î´óµÄµ£ÓÇÔÚÓÚÓÐÈË¿ÉÒÔ²¶»ñÊý¾Ý£¬sqlserverÖ§³Ö²ÉÓÃÖ¤ÊéÀ´¼ÓÃÜ
1£®´´½¨Ö¤Êé
create master key encryption by
password = 'administrator123'
--ÓÃÃÜÂëadmini--
create certificate c1
encryption by password = 'administrator123'
with subject = 'c1 certificate',
start_date='03/08/2009',
expiry_date = '02/08/2020';
go
2£®´´½¨²âÊÔ±í£¬name×Ö¶ÎΪҪ¼ÓÃܵÄÁУ¬Êý¾ÝÀàÐÍΪvarbinary
×¢Ò⣺¼ÓÃܵÄÀàÐͱØÐëÊÇvarbinary£¬ÒòΪ¼ÓÃܵÄÊý¾ÝÊÇÀàÐÍvarbinary
create table testB(id int identity(1,1),name varbinary(5000))
3£®Ê¹ÓüÓÃܺ¯ÊýÏò²âÊÔ±íÖÐдÈëÒ»Ìõ²âÊÔÊý¾Ý
insert into testB(name)
select encryptbycert(cert_id('c1'),'test')
4£®ÀûÓÃÏÂÃæµÄÓï¾äÀ´ÌáÈ¡¼ÓÃÜÊý¾Ý
select * from testB
5.ÀûÓÃÒÔÏÂÓï¾äÀ´½âÃÜÊý¾Ý
select id ,cast(decryptbycert(cert_id('c1'),name ,
N'administrator123')as varchar(20)) from testB
Íê³ÉÁË
Ïà¹ØÎĵµ£º
sql unionÓ÷¨ºÍsql union allÓ÷¨,sql unionЧÂÊ
1¡¢sql unionÓ÷¨
sql unionÔÚ²éѯÖпÉÒÔ½«Á½¸öSQL Óï¾äµÄ½á¹ûºÏ²¢ÆðÀ´¡£Èç¹ûÕâÑù¿´µÄ»°£¬ UNION ¸ú JOIN ÊÇÏàËƵģ¬Á½¸öÖ¸Á¿ÉÒÔÓɶà¸ö±í¸ñÖÐߢȡ×ÊÁÏ¡£
sql unionµÄÒ»¸öÏÞÖÆÊÇÁ½¸ö SQL Óï¾äËù²úÉúµÄÀ¸Î»ÐèÒªÊÇͬÑùµÄ×ÊÁÏÖÖÀà¡£ÁíÍ⣬µ±ÎÒÃÇÓà UNIONÕâ¸öÖ¸Áîʱ£¬Î ......
±¾ÎÄÀ´×Ô£ºhttp://zhidao.baidu.com/question/27978123.html?si=1
ÕâЩÊÇ SQL-92 ÉèÖÃÓï¾ä£¬Ê¹ SQL Server 2000/2005 ×ñ´Ó SQL-92 ¹æÔò¡£
µ± SET QUOTED_IDENTIFIER Ϊ ON ʱ£¬±êʶ·û¿ÉÒÔÓÉË«ÒýºÅ·Ö¸ô£¬¶øÎÄ×Ö±ØÐëÓɵ¥ÒýºÅ·Ö¸ô¡£µ± SET QUOTED_IDENTIFIER Ϊ OFF ʱ£¬±êʶ·û²»¿É¼ÓÒýºÅ£¬ÇÒ±ØÐë·ûºÏËùÓÐ Transact-SQL ±êÊ ......
exec xp_cmdshell 'md E:\project'
--ÏÈÅжÏÊý¾Ý¿âÊÇ·ñ´æÔÚÈç¹û´æÔÚ¾Íɾ³ý
if exists(select * from sysdatabases where name='bbsDB')
drop database bbsDB
--´´½¨Êý¾Ý¿âÎļþ
create database bbsDB
--Ö÷Êý¾Ý¿âÎļþ
on primary
(
name='bbsDB_data',--ΪÖ÷ÒªÊý¾Ý¿âÎļþÃüÃû
filename='E:\proj ......
²Ù×÷Êý¾Ý¿â½á¹¹µÄ³£ÓÃSql
ÏÂÃæÊÇSql Server ºÍ Access ²Ù×÷Êý¾Ý¿â½á¹¹µÄ³£ÓÃSql£¬ÄÚÈÝÓɺ£ÍÞÕûÀí£¬²»ÕýÈ·Óë²»ÍêÕûÖ®´¦»¹ÇëÌá³ö£¬Ð»Ð»¡£
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] dateti ......
Õâ¸öÂß¼¹Øϵէ¿´ÆðÀ´±È½Ï¸´ÔÓ£¬ÅªÇå³þÁ˾ͺã¡
ÓÐÁ½¸ö±í£¬
student(
id,
name,
primary key (id)
);
studentInfo(
id,
age,
address,
foreign key(id) references outTable(id) on delete cascade on update cascade
);
µ±ÎÒÃÇɾ³ýstudent±íµÄʱºò×ÔȻϣÍûstudentInfoÀïµÄÏà¹ØÐÅÏ¢Ò²±»É¾³ý£¬Õâ¾ÍÊÇÍâ¼üÆð×÷Óà ......