Îı¾µÄµ¼Èëµ¼³öºÍSQL½Å±¾µÄÖ´Ðз½·¨
Ò».Îı¾µ¼ÈëÊý¾Ý¿â
--²½Öè1.´´½¨¿ØÖÆÎļþ
load data¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ --1¡¢¿ØÖÆÎļþ±êʶ
infile 'E:\oradata\orcl\test\inf_user.txt'¡¡¡¡¡¡¡¡¡¡¡¡¡¡ --2¡¢ÒªÊäÈëµÄÊý¾ÝÎļþÃûΪinf_user.txt (Îļþȱʡ·Åµ½C:\ Ï£¬Èç¹û²»ÊÇ£¬¾ÍÐèÒªÖ¸Ã÷ȫ·¾¶)
append into table inf_user¡¡¡¡¡¡¡¡--3¡¢Ïò±ítestÖÐ×·¼Ó¼Ç¼
fields terminated by X'09'¡¡¡¡--4¡¢×Ö¶ÎÖÕÖ¹ÓÚX'09'£¬ÊÇÒ»¸öÖÆ±í·û£¨TAB£©
(mobile,id)¡¡¡¡ -----¶¨ÒåÁжÔӦ˳Ðò
--a¡¢insert£¬ÎªÈ±Ê¡·½Ê½£¬ÔÚÊý¾Ý×°ÔØ¿ªÊ¼Ê±ÒªÇó±íΪ¿Õ
--b¡¢append£¬ÔÚ±íÖÐ×·¼ÓмǼ
--c¡¢replace£¬É¾³ý¾É¼Ç¼£¬Ìæ»»³ÉÐÂ×°ÔØµÄ¼Ç¼
--d¡¢truncate£¬Í¬ÉÏ
--²½Öè2.sqlldr
sqlldr user_test/user_test@orcl control=E:\oradata\orcl\test\input.ctl
¶þ.µ¼³öÎı¾£º
·½·¨1£º
SQL>spool d:\output.xls
SQL> set heading off; --½ûÖ¹Êä³öÁбêÌâ
SQL> set feedback off; --½ûÖ¹ÏÔʾ×îºóÒ»ÐеļÆÊý·´À¡ÐÅÏ¢
SQL> set pagesize 50000; --ÉèÖÃÏÔʾ¶àÉÙÐдòÓ¡Ò»´ÎÁÐÃû
SQL>select * from inf_user;
SQL>spool off
·½·¨2£º
developer-file-new-sql windows-ÓÒ¼ü²éѯ½á¹û-export results-tsv
Èý.Ö´ÐÐSQL½Å±¾
SQL> @c:aa.sql;
Ïà¹ØÎĵµ£º
1.ÏÈÆôÓà xp_cmdshell À©Õ¹´æ´¢¹ý³Ì£º
Use Master
GO
Exec sp_configure 'show advanced options', 1
GO
Reconfigure;
GO
sp_configure 'xp_cmdshell', 1
GO
Reconfigure;
GO
(×¢£ºÒòΪxp_cmdshellÊǸ߼¶Ñ¡ÏËùÒÔÕâÀïÆô¶¯xp_cmdshell£¬ÐèÒªÏȽ« show advanced ......
--> Title : SQL Server 2005ÖеÄÎļþºÍÎļþ×é
--> Author : wufeng4552
--> Date : 2009-10-23
1¡¢ÎļþºÍÎļþ×éµÄº¬ÒåÓë¹ØÏµ
ÿ¸öÊý¾Ý¿âÓÐÒ»¸öÖ÷Êý¾ÝÎļþ.ºÍÈô¸É¸ö´ÓÎļþ¡£ÎļþÊÇÊý¾Ý¿âµÄÎïÀíÌåÏÖ¡£ Îļþ×é¿ÉÒÔ°üÀ¨·Ö²¼ÔÚ¶à¸öÂß¼·ÖÇøµÄÎļþ£¬ÊµÏÖ¸ºÔØÆ½ºâ¡£Îļþ×éÔÊÐ ......
SELECT CONVERT(varchar(100), CAST(@testFloat AS decimal(38,2)))
SELECT STR(@testFloat, 38, 2)
´ÓExcelÖе¼Èëµ½sql2000£¬ÓÐÒ»ÁГÁªÏµ·½Ê½”±ä³ÉÁËfloatÀàÐÍ£¬ÎÒÏëת»»³ÉnvarcharÀàÐÍ£¬ÓÃÏÂÃæµÄÓï¾ä
select convert(nvarchar(30),convert(int,ÁªÏµ·½Ê½)) from employee
go
//Êý¾ÝÒç³ö£¬²»ÐУ¡
select ......
JAVA£×Ö·û´®¹ýÂËÀà
package cn.com.hbivt.util;
/**
* Title:
*
* Description:
*
* Copyright: Copyright (c) 2005
*
* Company:
*
* @author not attributable
* @version 1.0
*/
public class StringUtils {
......
»ñÈ¡¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ýsqlserver×Ö¶ÎÃèÊö
Select o.name AS tableName, c.name AS columnName, p.[value] AS Description
from sysproperties p INNER JOIN
sysobjects o ON o.id = p.id INNER JOIN
syscolumn ......