Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLλÔËËã

SQLλÔËËã
select 2|8       --10
select 2|8|1    --11
select 10&8    --8,°üº¬,10=8+2
select 10&2    --2,°üº¬,10=2+8
select 10&4    --0,²»°üº¬
select 19&16  --16,°üº¬,19=16+2+1
select 19&8    --0,°üº¬,19=16+2+1
select * from SqlBitOperation where FBitTags&4=4
 
ÔÚȨÏÞÖеÄÓ¦ÓÃ
1¡¢Á½Õűí
£¨1£©¡¢²Ù×÷ÓëȨÏÞ±êÖ¾±í
if exists (select * from sysobjects where id = OBJECT_ID('[RightTags]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [RightTags]
CREATE TABLE [RightTags] (
[Pkid] [int]  IDENTITY (1, 1)  NOT NULL,
[RightsName] [nvarchar]  (50) NOT NULL,
[RightsTag] [int]  NOT NULL DEFAULT (0))
ALTER TABLE [RightTags] WITH NOCHECK ADD  CONSTRAINT [PK_RightTags] PRIMARY KEY  NONCLUSTERED ( [Pkid] )
SET IDENTITY_INSERT [RightTags] ON
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 1,'³Ô·¹',1)
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 2,'À­Êº',2)
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 3,'´òÅÚ',4)
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 4,'ÅÝæ¤',8)
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 5,'Éú×Ó',16)
INSERT [RightTags] ([Pkid],[RightsName],[RightsTag]) VALUES ( 6,'°ü¶þÄÌ',32)
SET IDENTITY_INSERT [RightTags] OFF

£¨2£©¡¢Óû§ÓëȨÏÞ±í
if exists (select * from sysobjects where id = OBJECT_ID('[RightUsers]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [RightUsers]
CREATE TABLE [RightUsers] (
[Pkid] [int]  IDENTITY (1, 1)  NOT NULL,
[FUser] [nvarchar]  (50) NOT NULL,
[UserRights] [int]  NOT NULL DEFAULT (0))
ALTER TABLE [RightUsers] WITH NOCHECK ADD  CONSTRAINT [PK_RightUsers] PRIMARY KEY  NONCLUSTERED ( [Pkid] )
SET IDENTITY_INSERT [RightUsers] ON
INSERT [RightUsers] ([Pkid],[FUser],[UserRights]) VALUES ( 1


Ïà¹ØÎĵµ£º

sqlÓï¾ä²éѯ±íµÄ×Ö¶ÎÃû

select name from syscolumns where id in (select id from sysobjects where type = 'u' and name = 'ÏàÓ¦±íÃû')  
ÓÃÒÔÉÏsqlÓï¾äÊäÈëÏàÓ¦±íÃû¾Í¿ÉÒԲ鵽±íµÄ×Ö¶ÎÃû£¬¶ÔÓ¦ºÃÊý¾Ý¿â ²éѯÊÇ·ñ´æÔڸñíÓï¾ä
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tb_cost]') and OBJECTPROPER ......

SQL ServerÈçºÎÌá¸ßÊý¾Ý¿â»¹Ô­µÄËÙ¶È

Ó°ÏìÊý¾Ý¿â»¹Ô­ËٶȵÄÒòËØºÍÓ°ÏìÊý¾Ý¿â±¸·ÝËٶȵÄÒòËØÏàͬ¡£³ý´ËÖ®Í⣬¼ÙÈçÄãʹÓÃSQL Server 2005µÄ»°£¬Ä㻹¿ÉÒÔÆô¶¯ÁíÍâÒ»¸öÓÅ»¯ÈÎÎñÀ´»¹Ô­µ±Ç°²»´æÔÚµÄÊý¾Ý¿â£¬ÔËÐл·¾³ÎªWindows XP£¬Windows 2003 Server »ò¸üа汾¡£
Perform Volume Maintenance Tasks
µ±Ä㻹ԭһ¸öеÄÍêÕûÊý¾Ý¿âÊÇ£¬SQL Server¶Á±¸·ÝÎļþÍ·£¬È»ºó´ ......

Sql Server2005ÓÃRow_Number·ÖÒ³´æ´¢¹ý³ÌµÄÐÔÄÜʵ²â

Sql Server2005µÄÒ»¸öÐÂÌØÐÔ±ãÊÇÎÒµÈÁ˺ܾõÄRow_Number(),ÒÔǰÓÃOracleʱÓÃrownumberд·ÖÒ³´æ´¢¹ý³ÌºÜ·½±ã£º£©
ÏÂÃæÊÇÎÒ×öµÄÒ»¸öССµÄ²âÊÔ£¬²âÊÔÎÒÔ­À´ÔÚsql server2000ÏÂËùÓõķÖÒ³´æ´¢¹ý³ÌÓëʹÓÃRow_Number()±àдµÄ´æ´¢¹ý³ÌÔÚSql Server2005ÉϵÄÖ´ÐÐЧÂÊ...
Êý¾Ý±í£º
REATE TABLE [dbo].[test](
[UserId] [int] Pri ......

SQLÖÐÈçºÎÓÃÒ»¸ö±í¸üÐÂÁíÒ»¸ö±í

for ACCESS :
update a, b set a.name=b.name1 where a.id=b.id
for SQL Server:
"update a set a.name=b.name1 from a,b where a.id=b.id"
update   a   set   a.status=b.status  
  from   table1   a,table2   b  
&nbs ......

¹ØÓÚÍøÕ¾SQL×¢ÈëµÄÎÊÌâ,ÒÔ¼°½â¾ö°ì·¨


×î½ü·¢ÏÖÎÒÃǹ«Ë¾µÄASP.NETµÄ´úÂëÓÐÆ´½ÓSQLÓï¾äµÄϰ¹ß£¡ÕâÊǷdz£Î£Ïյġ£ÒÔÏÂÎÒ¾ÙÀý˵Ã÷Ò»ÏÂ
Àý×Ó1£º
statement := "SELECT * from users WHERE name = '" + userName + "'; "
½«Óû§Ãû±äÁ¿(¼´username)ÉèÖÃΪ£º
a' or 't'='t£¬´ËʱԭʼÓï¾ä·¢ÉúÁ˱仯£º
SELECT * from users WHERE name = 'a' OR 't'='t';
Èç¹ûÕâ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ