Read From .ini File

Jan 4, 2006

hi,
i have a requirement in which i need to read from a .ini file in the stored procedure of sql server 2K.

is it possible? i tried searching on google but i cannot find anything that can help.

View 1 Replies


ADVERTISEMENT

Read Text File From SQL Server, Read Its Content, And Load It In RichTextBox (Related Component: Context.Response.BinaryWrite(), And StreamReader)

Nov 26, 2007

OBJECTIVE: I would like to read a text file from SQL Server 2000, read the text file content, and load its conntents in a RichTextBoxTHINGS I'VE DONE AND HAVE WORKING:1) I've successfully load a text file (ex: textFile.txt) in sql server database table column (with datatype Image) 2) I've also able to load the file using a Handler as below: using System;using System.Web;using System.Data.SqlClient;public class HandlerImage : IHttpHandler {string connectionString;public void ProcessRequest (HttpContext context) {connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["NWS_ScheduleSQL2000"].ConnectionString;int ImageID = Convert.ToInt32(context.Request.QueryString["id"]);SqlConnection myConnection = new SqlConnection(connectionString);string Command = "SELECT [Image], Image_Type FROM Images WHERE Image_Id=@Image_Id";SqlCommand cmd = new SqlCommand(Command, myConnection);cmd.Parameters.Add("@Image_Id", System.Data.SqlDbType.Int).Value = ImageID;SqlDataReader dr;myConnection.Open(); cmd.Prepare(); dr = cmd.ExecuteReader();if (dr.Read()){ //WRITE IMAGE TO THE BROWSERcontext.Response.ContentType = dr["Image_Type"].ToString();context.Response.BinaryWrite((byte[])dr["Image"]);}myConnection.Close();}public bool IsReusable {get {return false;}}}'>'>
<a href='<%# "HandlerDocument.ashx?id=" + Eval("Doc_ID") %>'>File
</a>- Click on this link, I'll be able to download or view the file WHAT I WANT TO DO, BUT HAVE PROBLEM:- I would like to be able to read CONTENT of this file and load it in a string as belowStreamReader SR = new StreamReader()SR = File.Open("File.txt");String contentText = SR.Readline();txtBox.text = contentText;BUT THIS ONLY WORK FOR files in the server.I would like to be able to read FILE CONTENTS from SQL Server.PLEASE HELP. I really appreciate it.

View 1 Replies View Related

Read Text File From Flat File Connection Manager SSIS

May 13, 2008

Hello Experts,
I am createing one task (user control) in SSIS. I have property grid in my GUI and 2 buttons (OK & Cancle).
PropertyGrid has Properties like SourceConnection, OutputConnection etc....right now I am able to populate Connections in list box next to Source and Output Property.

Now my question to you guys is depending on Source Connection it should read that text file associated with connection manager. After validation it should pick header (first line of text file bases on record type) and write it into new file when task is executed. I have following code for your reference. Please let me know I am going in right direction or not..
What should go here ?
->Under Class A

public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)

{

//Some code to read file and write it into new file

return DTSExecResult.Success;

}


public const string Property_Task = "CustomErrorControl";

public const string Property_SourceConnection = "SourceConnection";



public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)

{

if (node.Name != Property_Task)

{

throw new Exception(String.Format("Invalid task element '{0}' in LoadFromXML.", node.Name));

}

else

{

try

{



_sourceConnectionId = node.Attributes.GetNamedItem(Property_SourceConnection).Value;



}

catch (Exception ex)

{

infoEvents.FireError(0, "LoadFromXML", ex.Message, "", 0);

}

}

}

public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)

{

try

{

// // Create Task Element

XmlElement taskElement = doc.CreateElement("", Property_Task, "");

doc.AppendChild(taskElement);

// // Save source FileConnection

XmlAttribute sourcefileAttribute = doc.CreateAttribute(Property_SourceConnection);

sourcefileAttribute.Value = _sourceConnectionId;

taskElement.Attributes.Append(sourcefileAttribute);

}

catch (Exception ex)

{

infoEvents.FireError(0, "SaveXML", ex.Message, "", 0);

}

}

In UI Class there is OK Click event.

private void btnOK_Click(object sender, EventArgs e)

{

try

{



_taskHost.Properties[CustomErrorControl.Property_SourceConnection].SetValue(_taskHost, propertyGrid1.Text);

btnOK.DialogResult = DialogResult.OK;

}

catch (Exception ex)

{

Console.WriteLine(ex);

}

#endregion

}

View 10 Replies View Related

SQL 2012 :: How To Do Selective Read Of File Stored In File Table

Jul 2, 2015

I have a filetable that contains a binary file. I need to do a selective read of the file stored in the file table. I can write a C# CLR function that will open the file, read n bytes the from a starting byte. Or I can write a SQL statement that reads the stream in the filetable into a VARBINARY variable using SUBSTRING beginning at the starting byte (offset from 1) for the same n bytes.

Both give me the same result. However, the SQL statement takes considerably longer to read. I know there is overhead in reading through SQL (interpreted language), but the difference in performance is substantial, and I can only attribute this performance degradation if SQL first tries to "load" the entire stream before it identifies the portion of the stream that it needs to read beginning at the starting byte offset.

I wonder if this is the case or if there is another option to read a stream from a filetable directly through SQL queries that is more efficient.

View 3 Replies View Related

How Read File CSV File In Remote Server Using Bulk

Mar 24, 2008

Hi All,

I need to read a csv file, which is in remote server using SQl Bulk Insert Command.

Can I read a file Which is in remote server using BULK INSERT.

Thank you.......

View 1 Replies View Related

Read XML File From File System?

Jan 8, 2002

Anyone reading XML disk-files into SQL Server?

I have a process that I may want to do this with.

It would be a stored procedure that would read the XML attributes into 2 tables, the number of attributes could be 1-N, so I thought XML would be a good choice. Also, one of the attributes could be up to 4000 characters. I think this may limit our options, can 100-150 4000 character strings be passed in a standard call to a query/proc in SQL?

Currently the client application makes round-trip network calls to save upwards of 100 pairs of data. 1 header row, and many detail rows. All within a transaction.

I think If we move an XML file to the SQL box, then do all the import/save work on the "Server" side it would be much better. Cutting the transaction time down a lot by not doing so many round-trips at network speed...

Thoughts?

View 1 Replies View Related

Read File

Aug 28, 2003

Any one can help me how to read a file(.txt) with in the store procedure?

View 2 Replies View Related

Read XMl File

Feb 14, 2007

Can any one tell me how to read the XML file using sql syntax.

I hav also posted my full requirement why I need to read the XML file in Transact_Sql forum list.

View 1 Replies View Related

Cannot Read Some DBF File

Jun 6, 2007

Hi All

I am trying to load DBF files into SQL server within CLR (actually if just running the select statement outside, say within the SQLQuery window, i got the same result), but with the following error:

Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "VFPOLEDB" for linked server "MYDBF" does not contain the table "T8866064". The table either does not exist or the current user does not have permissions on that table.


I created the linked server in this way

EXEC sp_addlinkedserver
@server = 'MYDBF',
@provider = 'VFPOLEDB',
@srvproduct = 'My Data',
@datasrc = 'c:data'

i did not create the login since my SQL instance is running under a superaccount with all privilege.

What frustrates me is that i can read most of the dbf files, but just a few of them is not readable.

Can anyone give me some hints on it?

by the way, i am using vfp9.0

thanks

michael

View 7 Replies View Related

How To Read Binary File

Jun 6, 2007

Need help reading a binary file see below for details...
 
 I have uploaded a csv file into a sql table.
Now i want to extract the data and insert the data in the csv file into another sql table.
 What commands can i use in sql to extract/ read  the data ? 
 
 
 

View 7 Replies View Related

Creating A CSV File But Can't Read It.

Nov 4, 2003

Hi, I wrote a report builder that creates a CSV file but I can't redirect to the file to view it. ERROR Cannot find the Server!. This works fine on the dev machine but deploy it and it does not.

Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings("ConStr"))
Dim Cm As SqlCommand
Dim dr As SqlDataReader
Dim FileName As String = Guid.NewGuid.ToString & ".csv"
Dim FilePath As String = Server.MapPath("") & "CSVFiles" & FileName

Dim fs As FileStream = New FileStream(FilePath, FileMode.Create, FileAccess.Write)
Dim sw As StreamWriter = New StreamWriter(fs)
Dim Line As String
Dim lItem As System.Xml.XmlElement
Dim i As Int16
If ValidatePage() Then
Cm = New SqlCommand(BuildQuery, Conn)
Conn.Open()
dr = Cm.ExecuteReader()

Dim lXmlDoc As New System.Xml.XmlDocument()
lXmlDoc.LoadXml(txtHXml.InnerText)

For Each lItem In lXmlDoc.DocumentElement.SelectSingleNode("SELECT").ChildNodes
Select Case lItem.InnerText
Case "chkPRId"
Line &= "PR Id,"
Case "chkDateIssued"
Line &= "Date Issued,"
Case "chkOriginator"
Line &= "Originator,"
Case "chkBuyer"
Line &= "Buyer,"
Case "chkVendor"
Line &= "Vendor,"
Case "chkCostCode"
Line &= "Cost Code,"
Case "chkOracleRef"
Line &= "Oracle Reference,"
Case "chkTotal"
Line &= "Total,"
End Select
Next
Line = Line.Substring(0, Line.Length - 1)
sw.WriteLine(Line)

Line = ""
While dr.Read
For i = 0 To dr.FieldCount - 1
Line = Line & dr(i) & ","
Next
sw.WriteLine(Line)
Line = ""
End While

dr.Close()
Conn.Close()
sw.Close()
fs.Close()
Response.Redirect(FilePath)
End If
ResetPage()
PopulateListBoxFromXML()

View 1 Replies View Related

Read DataBase File

Jan 17, 2002

Hi,
I received a SQL Server 6.5 database (.dat and .Log files). I'm currently running 7.0. Is there any way to read/import this data?
I tried to do this:
I have installed SQL Server 6.5. And After install, I have created a database with the same names (.dat an .log) and make it bigger than the first .dat and .log files.
Then, I have stoped the SQL server service, have deleted the .DAT and .LOG files that i have created, and have copied the first .DAT and .LOG in their place. I have Started the SQL server service and the database was beeing suspected. I stil unable to read data.
Can you help me?

View 1 Replies View Related

READ A FILE WITH EXTENSION Dat

Aug 16, 1999

Hi,

I need to read a binary file with extention *.dat like this:
tat.dat and import it in ms sql server 7.0.

Thanks for any help

Dr Bangaly Diané

View 2 Replies View Related

Read Text File By T-SQL

Feb 16, 2008

hi
how can i read a txt file by using T-SQL commands.
thanx

View 12 Replies View Related

How Can I Read One External File (*.txt,*.csv) Through

Dec 14, 2001

How can I read one external file (*.txt,*.csv) through
stored procedure in MS Sql Server 2000 ?

On the database Interbase its very simple :

[CREATE TABLE table [EXTERNAL [FILE] ’ <filespec>’]
( <col_def> [, <col_def> | <tconstraint> …]);
EXTERNAL [FILE]“<filespec>
” Declares that data for the table under creation resides
in a table or file outside the database;
<filespec> is the complete file specification of the
external file or table]


Please advice

Thanks


Patricio

View 1 Replies View Related

Read Data From File Imp Into MS-SQL

Mar 24, 2006

Hi,

Ik like to read data from a file (well formatted) into as MS-SQL database.

What is the best way to do this.

Jim

View 1 Replies View Related

How To Read Active Log File

Apr 30, 2006

I am programming to read read sqlserver log file without shutdowning sqlserver. However it is said that the file is used by another process which I believe is sqlserver.
Is there any way to open log file without shutdowning server? I know that Log Explorer can read online log file. But I do not know the technology they are using.

View 3 Replies View Related

How Can I Read An Xml File From SQLServer

Mar 31, 2004

I need to know how to read an xml file using SQL. (in SQLServer)
Then i will manipulate the data and update my tables.

May be i can put the xml file in the IIS root.
Then what is required for the rest..

Thanks in advance

Benny

View 4 Replies View Related

How Can I Read/create A File From T-sql?

Jun 2, 2004

I need to create/read files from t-sql? Does anyone know how can I do it?

Thanks

View 3 Replies View Related

I Am Try To Read Mutliple Xml File

Feb 17, 2006

patelnimisha writes "i am try to read three xml files and transfer its data into sql databse.
so
i have no any idea about this qurey.
give me coding for this query"

View 2 Replies View Related

Is There A Way To Read A Excel File

Apr 23, 2007

into the sql query analyzer?
Thanks.

Jeff

View 7 Replies View Related

How To Read A File In A Directory Using T-Sql

Mar 3, 2008

Hi,
I need to read a XML file inside my procedure and put its contents in a variable.
How do I do it?
Is there a dbo procedure to do it?

Cheers,

View 2 Replies View Related

To Read Backup File

May 20, 2006

Hello,I have:- server MS SQL MSDE (2000)- database 'COLLBASE'- table 'MAIN'- row: column 'NAME' value 'version' and column 'VALUE' value '003'I make backup files by SQL query.I have more backups for different versions of this database (differentvalue in field 'VALUE' in table 'MAIN').I would like to read this value from backup file without server assist,to get backup as ordinary file.How to do it?How to move in this file?What is physical structure of backup file?I can't to read this file from begin by compare strings, because thesefiles are very large, few 100MB.regardsZenek

View 5 Replies View Related

Help Me! Read Text File In Sql

Jul 20, 2005

HELLO,please help me, how to read txt file and then insert it to sql table.i have file like this name.txe<...01230123192312390213200323423i4u23490342342342343....>I have 4 column and want to fractionise this text '012301231923123902132003'and put in to table.Best regardsRobert

View 3 Replies View Related

SQL DataBase MDF File Read Only

Nov 22, 2007



Dear All

I have some problem, I User Visual Web Developer 2005 Express to Create DateBase Files, when I copy the code and Database file to Server then user remote client to insert records and update, but it alert the error :

'/telecom' 應用程�中發生伺�器錯誤。


Failed to update database "D:TELECOMWORKSAPP_DATAPRODUCT.MDF" because the database is read-only.
æ??è¿°: 在執行目å‰? Web è¦?求的é?Žç¨‹ä¸­ç™¼ç”Ÿæœªè™•ç?†çš„ä¾‹å¤–æƒ…å½¢ã€‚è«‹æª¢é–±å †ç–Šè¿½è¹¤ä»¥å?–得錯誤的詳細資訊,以å?Šåœ¨ç¨‹å¼?碼中產生的ä½?置。

例外詳細資訊: System.Data.SqlClient.SqlException: Failed to update database "D:TELECOMWORKSAPP_DATAPRODUCT.MDF" because the database is read-only.



How to do this care. thanks

View 1 Replies View Related

Read XLSX File From ASP

Feb 15, 2008

Hello, I am trying to read a file "xlsx" from ASP, the problem is when I try to delete the file, ASP inform not have permits to delete it, it is as if the connection to file not closing properly, the code is:




Code Snippet




if extension = "xlsx" or extension = "xls" then 'si el archivo es excel

sFilePath = server.MapPath("../tmp/importar/"&archivo)
sDataDir = server.MapPath("../tmp/importar")
sSheetName = "Hoja1"

if extension = "xls" then
sFileConnectionString = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq="&sFilePath&";DefaultDir="&sDataDir&";"
else
sFileConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};READONLY=TRUE;DBQ="&sFilePath&";DefaultDir="&sDataDir&";"
end if
sFileSQL = "SELECT * FROM [" & sSheetName & "$]"

set oFileCN = server.createobject("ADODB.Connection") 'creo objeto adodb
oFileCN.Open sFileConnectionString 'abro el exel
set oFileRS = oFileCN.Execute(sFileSQL) 'selecciono los registros
if not oFileRS.EOF then 'si es distinto de EOF obtengo un array con los valores de las columnas
aSourceData = oFileRS.getRows()
end if
oFileRS.Close
set oFileRS = nothing
oFileCN.Close
set oFileCN = nothing

'asigno los mails a la variabls "readDatafile"
readDatafile = aSourceData






and the error





Microsoft VBScript runtime error '800a0046'

Permission denied

/gestion/edit_import_db_mail.asp, line 27




Any ideas?, Greetings and forgiveness for my English

View 9 Replies View Related

Read File From FTP Task

Apr 8, 2008



Hi All,

I have to implement a functionality which is able to read files from FTP and file reside at subfolders and some of subfolder is also dynamic means it may be any thing.

FTP Folder structure is like that

Root-
-----------1 (any name)
-----------------1.1(any name)
--------------------------1.1.1 (Static name)
----------------------------------files...(any name)

I tried to read file through loop but i am getting error. i able to get folder name at this level "-----------1 (any name)".


Please help me.

Thanks in advance

From
Manish Jain

View 6 Replies View Related

Read SDF File In Desktop

Jan 23, 2007

Dear all,

  I Need to read the Data from the SDF file in the Desktop. I have SQL Server 2005 in my System.

i know this is possible. but i dont know how it is ....  

 

regards,

Tamil

View 4 Replies View Related

How To Read Soap File

May 8, 2007

Hi all,



I am sending request to the third party server EX:"Http://somesight.sight.net/company.asp?AC="1000"&Item="200"&DT=05/08/2007" I am getting file in soap format


<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

- <SOAP-ENV:Envelope xmlnsOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">


- <SOAP-ENV:Body>


- <mtreamIResponse xmlns:m="uri:EXmsg">


<Success>false</Success>
</mtreamImageResponse>

- <SOAP-ENV:Fault>


<faultcode>SOAP-ENV:Error</faultcode>

<faultstring>No matching items were found.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

My question is how to read this line <faultstring>No matching items were found.</faultstring> . I need to capture the message in the variable.

Thanks for your help in advance





View 1 Replies View Related

Is It Possible To Read Configuration From An INI File ?

May 19, 2008

Hi guys,

That's the question. I'm sure I will be encourage to use xml or other configuration types rather than INI files. But INI file has the advantage of not embedding any object property path and can be used for both packages and other applications.
Imagine a large implementation with hundreds of packages and dozens of class libraries and applications which are configured from the same INI file.
Imagine also that the production environment must support both DTS 2000 and SSIS 2005 packages as it's impossible to migrate all at once.

I've read that SSIS would support INI configuration files:

In Package Configurations Kirk says:



"...The two types of package configurations that haven't been documented yet in books online is INI and SQL configurations. INI package configurations have basically been provided for backward compatibility..."

And in BOL, in the DTSConfigurationType Enumeration description we can find that the INIFile configuration Type is also mentioned.

Anyway, a possible workaround is building a custom task with an UI that allows to assign INI keys to object properties, but I wanted to know if it's possible to avoid this.

Thanks in advance

Leandro








View 1 Replies View Related

Best Way To Read A Paradox File?

Oct 17, 2006

We used to use DTS to read Paradox files. This is something we do regularly. DTS has a native Paradox driver. This seems to have disappeared in SSIS.

Can anyone recommend the best way to read Paradox Files with SSIS?

View 3 Replies View Related

Read Text File

Apr 24, 2007

Hi,

I have the text file in my server.

Is it possible to read that text file and insert into the table.



pls advice



Regards

Antony

View 3 Replies View Related

Certain Numeric Fields Not Read From The Excel File When Using A Excel File Source.

Jul 20, 2006

I have the Excel Connection Manager and Source to read the contents from an Excel file. For some reason couple of numeric fields from the Excel worksheet are brought over as nulls even though they have a value of 300 and 150. I am not sure why this is happening. I looked into the format of the fields and they are set to General in Excel, I tried setting them to numeric and that did not help.

All the other content from the excel file is coming thru except for the 2 numeric fields.

I tried to bring the contents from the excel source to a text file in csv format and for some reason the 2 numeric fields came out as blank.

Any inputs on getting this addressed will be much appreciated.

Thanks,

Manisha

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved