易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server使用Bulk Insert把一个文本导入到数据库

 
This is very common request recently – How to import CSV file into SQL Server? How to load CSV file into SQL Server Database Table? How to load comma delimited file into SQL Server? Let us see the solution in quick steps.
CSV stands for Comma Separated Values, sometimes also called Comma Delimited Values.
Create TestTable
USE TestData
GO
CREATE TABLE CSVTest
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME)
GO
Create CSV file in drive C: with name csvtest.txt with following content. The location of the file is C:\csvtest.txt
1,James,Smith,19750101
2,Meggie,Smith,19790122
3,Robert,Smith,20071101
4,Alex,Smith,20040202
Now run following script to load all the data from CSV to database table. If there is any error in any row it will be not inserted but other rows will be inserted.
BULK
INSERT CSVTest
from 'c:\csvtest.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
SELECT *
from CSVTest
GO
--Drop the table to clean up database.
SELECT *
from CSVTest
GO


相关文档:

SQL注入漏洞接触

 引自http://www.05112.com/Article/200908/26674.html
网站SQL注入漏洞全接触(高级篇)
文章整理发布:黑客风云 内容关注度:
291 更新时间:2009-8-15 6:36:47
看完入门篇和进阶篇后,稍加练习,破解一般的网站是没问题了。但如果碰到表名列名猜不到,或程序作者过滤了一些特殊字符,怎么提高注入的成功率?怎 ......

SQL Server 中 int、bigint、smallint 和tinyint

使用整数数据的精确数字数据类型。
 bigint 从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字)。
              存储大小为 8 个字节。
 int 从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,64 ......

MySQL对标准SQL的扩展

MySQL服务器包含一些其他SQL DBMS中不具备的扩展。注意,如果使用了它们,将无法把代码移植到其他SQL服务器。在某些情况下,你可以编写包含MySQL扩展的代码,但仍保持其可移植性,方法是用“/*... */”注释掉这些扩展。MySQL服务器能够解析并执行注释中的代码,就像对待其他MySQL语句一样,但其他SQL服务器将忽略 ......

根据当前等待事件名查找造成该等待事件的SQL

例如查找关于对library ....等待事件有贡献的SQL
select sql_text from V$sqlarea  where (address,hash_value) in
(select sql_address,sql_hash_value from v$session  where event like 'library%');
此语句只能运行于10g版本以上,因为10g中v$session视图包含了等待事件的信息了,9i中没有 ......

SQL 2005的备份文件导入到SQL 2000

參考: http://brightsky006.blog.163.com/blog/static/22583668200962195059485/
把SQL 2005的备份文件导入到SQL 2000
学习珍藏   2009-07-21 09:50   阅读616   评论0  
字号: 大大  中中  小小
电脑上安装了SQL Server 2005,现在想换回SQL2000来, ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号