ѧϰ£ºÁ½ÖÖSqlServerÊý¾Ý¿âÁ¬½ÓµÄʾÀý´úÂë
1¡¢ÊµÀýÒ»£º
public void SqlConnectionOpen()
{
SqlConnection myConn=new SqlConnection();
myConn.ConnectionString="server=(local);database=pubs;Trusted_Connection=yes";
myConn.Open();
}
2¡¢ÊµÀý¶þ
public void SqlConnectionOpen()
{
string ConnectString="server=(local);database=pubs;Trusted_Connection=yes";
SqlConnection myConn=new SqlConnection(ConnectString);
myConn.Open();
}
Á½¸ö¼òµ¥µÄÁÐ×Ó£¬ÒѾ°ÑÁ¬½ÓsqlserverµÄ¹Ø¼ü×ÖSqlConnectionString¶¨ÒåµÄ·Ç³£ÇåÎú¡£
Ïà¹ØÎĵµ£º
ÔÚÁÙʱ±í
create table #T (…)
ºÍ±í±äÁ¿
declare @T table (…)
Ö®¼äÖ÷ÒªÓÐ3¸öÀíÂÛÉϵIJ»Í¬¡£
µÚÒ»¸ö²»Í¬Ê¹ÊÂÎñÈÕÖ¾²»»á¼Ç¼±í±äÁ¿¡£Òò´Ë£¬ËüÃÇÍÑÀëÁËÊÂÎñ»úÖƵķ¶Î§£¬´ÓÏÂÃæµÄÀý×Ó¿ÉÏÔ¶øÒ×¼û£º
create table #T (s varchar(128))
declare @T table (s varchar(128))
insert into #T select 'old va ......
/*
--´´½¨ÊÓͼ
create view RandomView as select re=rand()
--×Ô¶¨Ò庯Êý:È¡µÃÖ¸¶¨·¶Î§µÄËæ»úÊý
create function RandData(
@a int,
@b int)
returns decimal(38,0)
as
begin
declare @r decimal(38,0)
select @r=cast(re*(@b-@a)+@a as decimal(38,0)) from RandomView
return(@r)
end
go
s ......
use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
create table t1 (a int )
insert into t1 select 1 union select 2 union select 3
create table t2 (a int )
insert into t2 select 3 union select 4 union select 5
go
sele ......
>>mysql:
1¡¢²é¿´ËùÓбíÃû£º
show tables [from db_name];
2¡¢²é¿´×Ö¶ÎÐÅÏ¢
SHOW FULL COLUMNS from db_name.table_name
»ñÈ¡ÒÔÏÂÐÅÏ¢
Field £º×Ö¶ÎÃû
Type£º×Ö¶ÎÀàÐÍ
Collation£º×Ö·û¼¯ £¨mysql 5.0ÒÔÉÏÓУ©
Null £ºÊÇ·ñ¿ÉÒÔΪNULL
Key£ºË÷Òý£¨PRI,unique,index)
Default£ºÈ±Ê¡Öµ
Extra£º¶îÍ⣨ÊÇ·ñ aut ......
¸ù¾Ý±í½á¹¹Éú³ÉJavaÎļþµÄ¹¤¾ß£¬ÔÚÈ¡µÃ±íµÄ×Ö¶ÎʱÈçºÎÈ¡µÃ±íµÄ¸÷ÖÖÐÅÏ¢ºÍ×¢ÊÍ£¬¾¶à·½ËÑÑ°ÕÒµ½ÈçÏÂ×ÊÁϱ¸Ó㺠oracle£º
user_tab_comments;±í×¢ÊÍ
user_col_comments;±í×Ö¶Î×¢ÊÍ
Ò ......