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

ÓÃsql²é¿´±í½á¹¹


1.oracle
 sql   = "SELECT column_name, data_type, data_length, nullable";
 sql += " from user_tab_columns ";
 sql += " where table_name='";
 sql += $tableName;
 sql += "'";
 select * from user_tab_comments   ²éѯ±íÃû¼°±í˵Ã÷£¨comment)
 select * from user_col_comments    ²éѯ±í¼°±íÖÐ×ֶεÄ˵Ã÷
2.sql server
select  name,xtype,length,isnullable  from  syscolumns
where id =(select  top 1 Id   from  sysobjects  where name = '±íÃû');
 
 sql   = "select  name,xtype,length,isnullable  from  syscolumns where id =";
 sql += " (select  top 1 Id   from  sysobjects  where name = '";
 sql += $tableName;
 sql += "')";
3.my sql
 sql   = "show columns from ";
 sql += $tableName;
»ò
 sql   = "desc ";
 sql += $tableName;
»ò
 sql   = "describe ";
 sql += $tableName;
 
 


Ïà¹ØÎĵµ£º

SQLÖбí±äÁ¿ºÍÁÙʱ±íµÄÓÅȱµã

http://www.cnblogs.com/Mainz/archive/2008/12/20/1358897.html
ʲôÇé¿öÏÂʹÓñí±äÁ¿£¿Ê²Ã´Çé¿öÏÂʹÓÃÁÙʱ±í£¿
±í±äÁ¿£º
DECLARE @tb  table(id   int   identity(1,1), name   varchar(100))
INSERT @tb
SELECT id, name
from mytable
WHERE name like ‘zhang%&rsquo ......

SQLÓαêÔ­ÀíºÍʹÓ÷½·¨(ת)

ÔÚÊý¾Ý¿â¿ª·¢¹ý³ÌÖУ¬µ±Äã¼ìË÷µÄÊý¾ÝÖ»ÊÇÒ»Ìõ¼Ç¼ʱ£¬ÄãËù±àдµÄÊÂÎñÓï¾ä´úÂëÍùÍùʹÓÃSELECT INSERT Óï¾ä¡£µ«ÊÇÎÒÃdz£³£»áÓöµ½ÕâÑùÇé¿ö£¬¼´´Óijһ½á¹û¼¯ÖÐÖðÒ»µØ¶ÁȡһÌõ¼Ç¼¡£ÄÇôÈçºÎ½â¾öÕâÖÖÎÊÌâÄØ£¿ÓαêΪÎÒÃÇÌṩÁËÒ»ÖÖ¼«ÎªÓÅÐãµÄ½â¾ö·½°¸¡£ 1.1 ÓαêºÍÓαêµÄÓŵã ÔÚÊý¾Ý¿âÖУ¬ÓαêÊÇÒ»¸öÊ®·ÖÖØÒªµÄ¸ÅÄî¡£ÓαêÌṩÁËÒ» ......

shp Îļþµ¼³ösql»òµ¼Èëpostgis

1.Ö±½Óµ¼ÈëÊý¾Ý¿â
   shp2pgsql -s "4326" -W "GBK" E:\shape\Road_polyline.shp  
road_cross| psql -U postgres -h 172.17.40.83 -d test
2.µ¼³ösql
   shp2pgsql -s "4326" E:\shape\Road_polyline.shp blocks >
E:\roadcross\blocks.sql
3 ......

35Ìõ»ù±¾SQLÓï¾ä

 1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select
emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'ÈÕÆÚ²»Ïê') birthday
from employee
order by dept
 
¡¡¡¡
2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ÐÔ±ð¡ ......

SQL Server 2005 CTEµÄÓ÷¨

if object_id('[tb]') is not null
drop table [tb] 
go
create table [tb]([id] int,[col1] varchar(8),[col2] int) 
insert [tb] 
select 1,'ºÓ±±Ê¡',0 union all
 select 2,'ÐĮ̈ÊÐ',1 union all
 select 3,'ʯ¼ÒׯÊÐ',1 union all
 select 4,'ÕżҿÚÊÐ',1 union all
&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ