如何将记事本数据保存到数据库(SQL2005) [英] how to save a notepad data into database (sql2005)

查看:264
本文介绍了如何将记事本数据保存到数据库(SQL2005)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我已经在sql中创建了具有某些参数的存储过程
我想要的是,我应该打开一个记事本并写以下行
1,shankar,22 ie(id,name,age)并保存文件.现在,当我刚刚执行存储过程时
上面的值应该保存在数据库中.我该怎么办,请帮忙...

suppose i have created a stored procedure in sql having some parameter
what i want is that, i should open a notepad and write a following line
1,shankar,22 ie(id,name,age) and save the file .now when i just execute a stored procedure
the above values should be saved in the database.how can i do this please help its urgent...

推荐答案

您的问题不是很清楚.但是基于我的假设,在我看来您似乎想解析文本文件的内容并将其存储在DB中.您必须打开文本文件,提取字段,然后将这些字段传递给存储的proc.提取3个字段应该就像调用String.Split一样简单.
Your question''s not very clear. But based on my assumptions, it seems to me you want to parse the contents of the text file and store in in the DB. You''d have to open the text file, extract the fields, and then pass those fields to the stored proc. Extracting the 3 fields should be as simple as calling String.Split.


我同意Nishant的回答.使用他的方法,您将在应用程序中进行数据解析,该应用程序将拆分输入,然后通过存储过程将数据发送到数据库以进行插入.
如果要将行全部发送到存储过程并进行拆分并将其全部插入数据库中,请
I agree with Nishant''s answer. With his approach you would be doing the parsing of the data in an application which would split the input and then send the data via stored procedure to the database for insert.
If you want to send the line in its entirety to the stored procedure and have it do the split and insert all in the database, this may help you.


这篇关于如何将记事本数据保存到数据库(SQL2005)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆