ÓÃSQLÓï¾ä´´½¨±í&ÓÃSQLÓï¾ä´´½¨Êý¾Ý¿â
Êý¾Ý¿âÖеÄËùÓÐÊý¾Ý´æ´¢ÔÚ±íÖС£Êý¾Ý±í°üÀ¨ÐкÍÁС£Áоö¶¨Á˱íÖÐÊý¾ÝµÄÀàÐÍ¡£Ðаüº¬ÁËʵ¼ÊµÄÊý¾Ý¡£
ÀýÈ磬Êý¾Ý¿âpubsÖеıíauthorsÓоŸö×ֶΡ£ÆäÖеÄÒ»¸ö×Ö¶ÎÃûΪΪau_lname£¬Õâ¸ö×ֶα»ÓÃÀ´´æ´¢×÷ÕßµÄÃû×ÖÐÅÏ¢¡£Ã¿´ÎÏòÕâ¸ö±íÖÐÌí¼ÓÐÂ×÷Õßʱ£¬×÷ÕßÃû×־ͱ»Ìí¼Óµ½Õâ¸ö×ֶΣ¬²úÉúÒ»ÌõмǼ¡£
ͨ¹ý¶¨Òå×ֶΣ¬Äã¿ÉÒÔ´´½¨Ò»¸öÐÂ±í¡£Ã¿¸ö×Ö¶ÎÓÐÒ»¸öÃû×ÖºÍÒ»¸öÌض¨µÄÊý¾ÝÀàÐÍ£¨Êý¾ÝÀàÐÍÔÚºóÃæµÄ“×Ö¶ÎÀàÐ͔һ½ÚÖн²Êö£©£¬ÀýÈç×Ö¶Îau_lname´æ´¢µÄÊÇ×Ö·ûÐÍÊý¾Ý¡£Ò»¸ö×Ö¶ÎÒ²¿ÉÒÔ´æ´¢ÆäËüÀàÐ͵ÄÊý¾Ý¡£
ʹÓÃSQL Sever£¬´´½¨Ò»¸öбíµÄ·½·¨ÊǺܶàµÄ¡£Äã¿ÉÒÔ¿ÉÖ´ÐÐÒ»¸öSQLÓï¾ä»òʹÓÃSQLÊÂÎñ¹ÜÀíÆ÷£¨SQL Enterprise Manager£©À´´´½¨Ò»¸öÐÂ±í¡£ÔÚÏÂÒ»½ÚÀÄ㽫ѧ»áÈçºÎÓÃSQLÓï¾äÀ´´´½¨Ò»¸öÐÂ±í¡£
Ò»¡¢ÓÃCREATEÓï¾ä´´½¨±í
×¢Ò⣺
Èç¹ûÄ㻹ûÓн¨Á¢×Ô¼ºµÄÊý¾Ý¿â£¬ÏÖÔÚ¾ÍÌø»Øµ½µÚÈýÕ´´½¨Õâ¸ö¿â¡£Äã¾ø²»ÄÜÏòmaster,tempdb»òÈκÎÆäËûÈκÎϵͳÊý¾Ý¿âÖÐÌí¼ÓÊý¾Ý¡£
´ÓSQL Sever³ÌÐò×飨ÔÚÈÎÎñÀ¸ÖУ©ÖÐÆô¶¯ISQL/w³ÌÐò¡£³öÏÖ²éѯ´°¿Úºó£¬´Ó´°¿Ú¶¥²¿µÄÏÂÀÁбíÖÐÑ¡ÔñÄãÔÚµÚÈýÕÂËù´´½¨µÄÊý¾Ý¿â¡£ÏÂÒ»²½£¬ÔÚ²éѯ´°¿ÚÖмüÈëÏÂÃæµÄSQLÓï¾ä£¬µ¥»÷Ö´Ðвéѯ°´Å¥£¬Ö´ÐÐÕâ¸öÓï¾ä£º
CREATE TABLE guestbook (visitor VARCHAR(40),comments TEXT,entrydate DATETIME)
Èç¹ûÒ»ÇÐÕý³££¬Äã»áÔÚ½á¹û´°¿ÚÖп´µ½ÈçϵÄÎÄ×Ö£¨Èç¹û³öÏÖÒì³££¬Çë²ÎÔĵÚÈýÕ£©£º
This command dit not return data ,and it did not return any rows
×£ºØÄ㣬ÄãÒѾ½¨Á¢ÁËÄãµÄµÚÒ»¸ö±í£¡
ÄãËù´´½¨µÄ±íÃûΪguestbook£¬Äã¿ÉÒÔʹÓÃÕâ¸ö±íÀ´´æ´¢À´×ÖÄãÕ¾µã·ÃÎÊÕßµÄÐÅÏ¢¡£ÄãÊÇÓÃCREATE TABLEÓï¾ä´´½¨µÄÕâ¸ö±í£¬Õâ¸öÓï¾äÓÐÁ½²¿·Ö£ºµÚÒ»²¿·ÝÖ¸¶¨±íµÄÃû×Ö£»µÚ¶þ²¿·ÝÊÇÀ¨ÔÚÀ¨ºÅÖеĸ÷×ֶεÄÃû³ÆºÍÊôÐÔ£¬Ï໥֮¼äÓöººÅ¸ô¿ª¡£
±íguestbookÓÐÈý¸ö×ֶΣºvisitor,comments ºÍentrydate¡£
Visitor ×ֶδ洢·ÃÎÊÕßµÄÃû×Ö£¬
Comments ×ֶδ洢·ÃÎÊÕ߶ÔÄãÕ¾µãµÄÒâ¼û£¬
Entrydate ×ֶδ洢·ÃÎÊÕß·ÃÎÊÄãÕ¾µãµÄÈÕÆÚºÍʱ¼ä¡£
×¢Òâÿ¸ö×Ö¶ÎÃûºóÃ涼¸úÓÐÒ»¸öרÃŵıí´ïʽ¡£À
Ïà¹ØÎĵµ£º
ʵÀý1£ºÖ»·µ»Øµ¥Ò»¼Ç¼¼¯µÄ´æ´¢¹ý³Ì¡£
ÒøÐдæ¿î±í£¨bankMoney£©µÄÄÚÈÝÈçÏÂ
Id
userID
Sex
Money
001
Zhangsan
ÄÐ
30
002
Wangwu
ÄÐ
50
003
Zhangsan
ÄÐ
40
ÒªÇó1£º²éѯ±íbankMoneyµÄÄÚÈݵĴ洢¹ý³Ì
create procedure sp_query_bankMoney
as
select * from bankMoney
go
exec sp_query_bankMoney
×¢ ......
ALTER function [dbo].[split]
(
@SourceSql varchar(8000),
@StrSeprate varchar(10)
)
returns @temp table(F1 varchar(100))
as
begin
declare @i int
set @SourceSql = rtrim(ltrim(@SourceSql))
set @i = charindex(@StrSeprate,@SourceSql)
while @i >= 1
begin
if len( ......
1. SQLÐÐתÁдúÂë
-
-
±íÀïÃæÓÐÕâôһ×éÊý¾Ý:
code price
'MCU0-3' 15
'MCU0-3' 20
'MCU0-3' 22
'MCU ......
SQL×¢Èë¾Í²»ÓýéÉÜÁË£¬ÍøÉϺܶࡣÏÂÃæ½éÉÜһϷÀÖ¹
SQL×¢ÈëµÄ·½·¨¡£
ʹÓÃ
quotename º¯ÊýºÍ
sp_executesql
²Î¿¼Èç
ϱí½á¹¹£ºÕâÊÇÒ»¸öÎĵµ±íÀïÃæÓÐһЩ¼òµ¥µÄ×Ö¶ÎÐÅÏ¢
CREATE
TABLE
[dbo]
.
[DocumentInfo]
(
[ID]
[int]
IDENTITY
(
1,
1) primary key
NOT
......