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

SQLÖ®Æß——Êý¾ÝÀàÐÍ£¬Á÷¿Ø

SQL2000µÄÊý¾ÝÀàÐͼ°³¤¶È
==============================
bigint 8
binary 8000
bit 1
char 8000
datetime 8
decimal 17
float 8
image 16
int 4
money 8
nchar 8000
ntext 16
numeric 17
nvarchar 8000
real 4
smalldatetime 4
smallint 2
smallmoney 4
sql_variant 8016
sysname 256
text 16
timestamp 8
tinyint 1
uniqueidentifier 16
varbinary 8000
varchar 8000
SQLÖÐselectÓëset¶Ô±äÁ¿¸³Öµ
====================================
SQL Server ÖжÔÒѾ­¶¨ÒåµÄ±äÁ¿¸³ÖµµÄ·½Ê½ÓÃÁ½ÖÖ£¬·Ö±ðÊÇ SET ºÍ SELECT¡£
¶ÔÓÚÕâÁ½ÖÖ·½Ê½µÄÇø±ð£¬SQL Server Áª»ú´ÔÊéÖÐÒѾ­ÓÐÏêϸµÄ˵Ã÷£¬µ«ºÜ¶àʱºòÎÒÃÇ
²¢Ã»ÓÐ×¢Ò⣬ÆäʵÕâÁ½ÖÖ·½Ê½»¹ÊÇÓкܶà²î±ðµÄ¡£
SQL ServerÍƼöʹÓà SET ¶ø²»ÊÇ SELECT ¶Ô±äÁ¿½øÐи³Öµ¡£
µ±±í´ïʽ·µ»ØÒ»¸öÖµ²¢¶ÔÒ»¸ö±äÁ¿½øÐи³ÖµÊ±£¬ÍƼöʹÓà SET ·½·¨¡£
ϱíÁгö SET Óë SELECT µÄÇø±ð¡£ÇëÌرð×¢ÒâºìÉ«²¿·Ö¡£
 
set
select
ͬʱ¶Ô¶à¸ö±äÁ¿Í¬Ê±¸³Öµ
²»Ö§³Ö
Ö§³Ö
±í´ïʽ·µ»Ø¶à¸öֵʱ
³ö´í
½«·µ»ØµÄ×îºóÒ»¸öÖµ¸³¸ø±äÁ¿
±í´ïʽδ·µ»ØÖµ
±äÁ¿±»¸³nullÖµ
±äÁ¿±£³ÖÔ­Öµ
ÏÂÃæÒÔ¾ßÌåʾÀýÀ´ËµÃ÷ÎÊÌ⣺
create table chinadba1(
userid int ,
addr varchar(128)
)
go
insert into chinadba1(userid,addr) values(1,'addr1')
insert into chinadba1(userid,addr) values(2,'addr2')
insert into chinadba1(userid,addr) values(3,'addr3')
go
±í´ïʽ·µ»Ø¶à¸öֵʱ£¬Ê¹Óà SET ¸³Öµ
declare @addr varchar(128)
set @addr = (select addr from chinadba1)
/*
--³ö´íÐÅϢΪ
·þÎñÆ÷: ÏûÏ¢ 512£¬¼¶±ð 16£¬×´Ì¬ 1£¬ÐÐ 2
×Ó²éѯ·µ»ØµÄÖµ¶àÓÚÒ»¸ö¡£µ±×Ó²éѯ¸úËæÔÚ =¡¢!=¡¢<¡¢<=¡¢>¡¢>= Ö®ºó£¬»ò×Ó²éѯÓÃ×÷±í´ïʽʱ£¬ÕâÖÖÇé¿öÊDz»ÔÊÐíµÄ¡£
*/
go
±í´ïʽ·µ»Ø¶à¸öֵʱ£¬Ê¹Óà SELECT ¸³Öµ
declare @addr varchar(128)
select @addr = addr from chinadba1
print @addr --½á¹û¼¯ÖÐ×îºóÒ»¸ö addr ÁеÄÖµ
--½á¹û: addr3
go
±í´ïʽδ·µ»Øֵʱ£¬Ê¹Óà SET ¸³Öµ
declare @addr varchar(128)
set @addr = '³õʼֵ'
set @addr = (select addr from chinadba1 where userid = 4 )
print @addr --nullÖµ
go
±í´ïʽδ·µ»Øֵʱ£¬Ê¹Óà SELECT ¸³Öµ
declare @addr varchar(128)
set @addr = '³õʼֵ'
select @addr = addr from chinadba1 where userid = 4
print


Ïà¹ØÎĵµ£º

SQL ÐÐÊýµÄÑ¡Ôñ

OracleÊý¾Ý¿â
SELECT
    *
from
(
    SELECT
        ROWNUM AS NO_ROW
        ,row_.*
    from
    (
        SELECT
 &nb ......

SQL ServerºÍOracleµÄ³£Óú¯Êý¶Ô±È

---------Êýѧº¯Êý
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) v ......

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

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

ѧϰSQLÓï¾äÖ®SQLÓï¾ä´óÈ«

¡¡--Óï ¾ä ¹¦ ÄÜ¡¡¡¡--Êý¾Ý²Ù×÷¡¡¡¡SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁС¡¡¡INSERT --ÏòÊý¾Ý¿â±íÌí¼ÓÐÂÊý¾ÝÐС¡¡¡DELETE --´ÓÊý¾Ý¿â±íÖÐɾ³ýÊý¾ÝÐС¡¡¡UPDATE --¸üÐÂÊý¾Ý¿â±íÖеÄÊý¾Ý¡¡¡¡--Êý¾Ý¶¨Òå¡¡¡¡CREATE TABLE --´´½¨Ò»¸öÊý¾Ý¿â±í¡¡¡¡DROP TABLE --´ÓÊý¾Ý¿âÖÐɾ³ý±í¡¡¡¡ALTER TABLE --ÐÞ¸ÄÊý¾Ý¿â±í½á¹¹¡¡¡¡CREATE VI ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ