Read Text From Message Tab
Feb 28, 2008
I am trying to catch and parse the message after passing a transaction to SQL from a clr proc. For example in the below code after passing sp.ExecuteAndSend(qry) how can I receive the message of "(1 row(s) affected)" from the messages tab. I know that I can write to the message tab with sp.Send, but is it possible to read from the output?
Thank you in advance for your assistance
Code Snippet
Imports System.Data.SqlClient
Partial Public Class StoredProcedures
_
Public Shared Sub prepxml _
(ByVal sInputFile As String)
Dim sContents As String
Dim sp As SqlPipe = SqlContext.Pipe()
Dim qry As New SqlCommand()
Dim stmReader As New StreamReader(sInputFile)
Try
'Create a string reader and pass it the input parameter of the
'file path. The sContents variable will receive the content of
'the stream reader
sContents = stmReader.ReadToEnd()
stmReader.Close()
'Replace single quotes to enclose the quotes so errors aren't raised
sContents = sContents.Replace("'", "''''")
'Create a query object and convet the sContents to an xml data
'type
qry.CommandText = " SELECT CONVERT(XML, '" & _
sContents & "')"
'Execute the query and pass the result set back to SQL
sp.ExecuteAndSend(qry)
sp.Send(qry.CommandText.ToString.Substring(1, 3000))
Catch ex As Exception
'Cath any exceptions and use a sqlpipe to send the error
'message back to sql
sp.Send(ex.Message.ToString)
End Try
End Sub
End Class
View 3 Replies
ADVERTISEMENT
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
Feb 16, 2008
hi
how can i read a txt file by using T-SQL commands.
thanx
View 12 Replies
View Related
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
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
Apr 23, 2007
Hi Frinds,
I have the text file in my server.
Is it possible to read the text file and insert into table via sql server stored procedure.
View 1 Replies
View Related
Jul 24, 2001
Can the header record be read into one table, the detail into another and the trailer into a third within one data transformation or would this have to be done with an active script task.
I then have to take this data and write it back out to one file with a header and detail lines.
Would vb be better for that part or can it be done easily with active script using the file system object. I could write the one header record and append the detail lines after.
Any help would be appreciated.
Thanks,
DTS newbie.
View 3 Replies
View Related
Mar 26, 2007
with the help of the following code am able to read the text file
now i need to insert values to the datatable in dataset
can anybody help me on this regard
string path = Server.MapPath("Account.txt");
StreamReader sr = File.OpenText(path);
string contents = sr.ReadToEnd();
Label1.Text = contents;
Label1.Text = contents.Replace(Environment.NewLine,"<br>");
sr.Close();
how shall i spilt them and add each value to two fields of the datatable
for example i have the fields in text file as
Username1:Password1
Username2:Password2
etc
i need to add the username seperatelt to a field called username in table
and password in password field of the datatable
an example with code would be better and helpful
thanks
shruhti
View 1 Replies
View Related
Mar 2, 2007
Hello there
I have written a small code that is used to read records from a txt or a csv file, but when i try to read from a txt or csv file which is in unicode, i get the following error
No value given for one or more required parameters........this error is recieved on the following line
dtadpt.Fill(DataSet.Tables("table2"))
The code for reading from a file is as follows
Dim dtrow As DataRow
Dim cmdtxt, file, path
Dim dtadpt As New System.Data.OleDb.OleDbDataAdapter
Dim Command As System.Data.OleDb.OleDbCommand
Dim Conn As System.Data.OleDb.OleDbConnection
file = 'name of the file'
path = 'path of file'
Conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & path & ";" & "Extended Properties=""text;HDR=YES;FMT=Delimited""")
For Each dtrow In DataSet.Tables("table1").Rows
Dim id
id = dtrow.Item("id")
cmdtxt = "Select * from " & file & " where id = " & id
Command = New System.Data.OleDb.OleDbCommand(cmdtxt, Conn)
dtadpt.SelectCommand = Command
Next
DataSet.Tables.Add("table2")
dtadpt.Fill(DataSet.Tables("table2"))
this code works if i choose a csv or txtfile which is in ANSI format. But i want to read from a unicode file because i have some information in that unicode format that i want to store
any idea how this can be possible
thanks and best regards
Saad
View 1 Replies
View Related
Feb 11, 1999
Hello:
We are running some test on our application which involves long-running transaction in an application that was purchased from a vendor. It is a PB
and we don't have access to all of the code. We are not sure why it runs so slow when we start this long_running process. We are not sure if they are using a stored procedure or not.
We ran updaet statistics becuase alot of data was added before we kicked off the process. We want to capture all of the sql code that is running so we can perhaps add indices.
Under EM, we click on the thread and can get a dialog box that shows the running sql code but the dialog box isn't expandable
THerefore I am wondering if there is a storec provedure or if someone has a script, to see what the complete text of sql is for a running proess? Any shareware tools?
Any information that you can provide will be appreciated. Thanks.
David Spaisman
--------------------------------------------------------------------------------
|
View 1 Replies
View Related
Sep 8, 2006
Hi!
We currently have a problem while reading Excel files. The file has one column we want to read as DT_(W)STR which Jet delivers to us only as DT_R8 as there are plenty of numerical entries in that column before one alphanumerical appears.
We first tried with IMEX=1 but as described in http://support.microsoft.com/kb/194124/en-us will only parse the first eigth characters as "TypeGuessRows" is set to 8 and can't be edited.
Is there any way to read a column in Excel in a way typed by the SSIS designer (DT_(w)STR in our case)?
With best regards,
Hauke Schlichting
PS: Designing a "decoy" Excel file with column headers and first columns set is not really considered an option ;-)
View 2 Replies
View Related
Apr 16, 2008
Hi,
I just want to know how to search text/record inside the Html files. I had one column in my database named €˜Path€™ I saved the html file names in this column and the physical files in a folder. Full Text search is enabled on this column. Whenever I try to search it returns nothing.
Just need one small example to know how it works, what functions used to search inside the files and how.
Thanks
Navi
View 8 Replies
View Related
Sep 23, 2014
Our company sends out sms text mesgs from our MSSQL Database and stores the responses in a table when a reply is received. My problem is now that some mesgs are showing as blank(even when I copy the raw data field out of the query return window) yet when I check the length of the field, it contains data. I set the field to a Temp Variable and converted the contents to ascii and definitely found that it shows data.
We use this reply as a rating system and I have queries and functions that extract the info I need, the problem is that I need to convert this field into a readable field first before I can extract the info.
SQL example:
Select T2.ReceivedData , Datalength(T2.ReceivedData) Length
FROM DMZWEB01.[SMS_SERVICE].[dbo].[Sent] T1
LEFT JOIN DMZWEB01.[SMS_SERVICE].[dbo].[Reply] T2 ON T1.ID = T2.ID
INNER JOIN Clm_ClaimsRegister T3 ON T1.PolicyNumber = T3.Claim_No
Where T1.id = 1158008
This returns a blank field and a datalength of 6.
To prove that the field contains data, a query that can run is:
DECLARE @Temp VarChar(8) =
(Select T2.ReceivedData
FROM DMZWEB01.[SMS_SERVICE].[dbo].[Sent] T1
LEFT JOIN DMZWEB01.[SMS_SERVICE].[dbo].[Reply] T2 ON T1.ID = T2.ID
INNER JOIN Clm_ClaimsRegister T3 ON T1.PolicyNumber = T3.Claim_No
Where T1.id = 1158008
[Code] ...
This returns < Line numbers >
1>
2>1
3>
4>0
5>&
6>:
7>
the actual field is pasted between these two comment '' signs below
''
see? nothing
View 4 Replies
View Related
Jan 19, 2006
Hi,
I'm new to SQL Server and I'm building an SQL Server 2000 database that will be loaded and accessed via stored procedures.
One of the requirements is that I have to log any errors that occur to an error log table containing the date/time, error code and the exact error text - ie containing problem table name, column name, etc.
The problem I'm having is that I can't see a way of capturing the exact error text in a stored procedure. The only thing that seems available is @@error which only returns the error code - not the actual text. I could go to the sysmessages table using the error code but that'll only return the message template containing parameters - not containing the actual table/column/etc causing the problem.
Does anyone have any ideas how to retrieve the exact error message text?
Any help would be most appreciated!
Regards,
Chris
View 2 Replies
View Related
Mar 28, 2008
hi my friends
i want read data from text file,and write to my table in sql,
please help me
M.O.H.I.N
View 6 Replies
View Related
Jul 27, 2001
I am pulling my hair out trying to resolve this issue. I have placed several messages on different message boards and have not received any response to this issue. Can anyone here please help me?
I have installed 'full text index' on a server, initialized it and created a job to full text two fields in a table. I can see that the last refresh was a day ago. I am calling a stored procedure: (the server is version 7 of SQL Server with sp3)
CREATE PROCEDURE [SearchFaq]
@pSearchString varchar(200)
AS
SELECTfaqID, FaqQuestion, FaqText, Status, InputDate
FROMfaqs
WHEREContains(*, @pSearchString) and Status = 1
All I get is this error message, whether I call this from an asp page or run it directly from query analyzer:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Search on full-text catalog 'etr_fts' for database ID 10, table ID 1429580131 with search condition 'faq' failed with unknown result (324bd27c).
Please HELP!!
View 3 Replies
View Related
Jan 29, 2004
How do you pass parameters and text to the message area... i know how to pass parameters or pass text how do i do both... for example.
Exec master.dbo.xp_sendmail @recipients = 'johndoe' @message = 'hello and @number'
PLZ HELP!!!!!!
View 1 Replies
View Related
May 30, 2008
Hi,
To be more clear. My problem is :
1) I launched the stataments behing via sql server studio :
Use AutClust
GO
SET NOCOUNT ON;
Set statistics IO ON
GO
select * FROM table_1;
Go
Set statistics IO OFF
GO
2) I have then obtained in tab message the result displayed in text format in tab messages :
Table 'table_1'. Scan count 1, logical reads 490, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
The objective is to implement those statements in a stored procedure that will be able to recover in automatic manner the content of tab messages.
This text is a system response connected to the statements above. I think that exist a system variable which contain the result displayed in tab messages.
I tried tu use @@rowcount it deos not work because this system variable return number of row affacted by last statement.
Does it exist another system variable that could contain the text which is in tab messages?
I do need a solution for this problem.
Please bring me your help.
Thanks for your help.
Tietie.
View 2 Replies
View Related
May 29, 2008
Hi,
I execute a query via queries editor embedded in sql srver studio.then i have query result in results tab and a text message in tab messages. Does it exist a T-SQL sys global variable as of i could to retrieve the text message that is displayed in tab messages?
To be more clear. My problem is :
1) I launched the stataments behing via sql server studio :
Use AutClust
GO
SET NOCOUNT ON;
Set statistics IO ON
GO
select * FROM table_1;
Go
Set statistics IO OFF
GO
2) I have then obtained in tab message the result displayed in text format in tab messages :
Table 'table_1'. Scan count 1, logical reads 490, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
The objective is to implement those statements in a stored procedure that will be able to recover in automatic manner the content of tab messages.
This text is a system response connected to the statements above. I think that exist a system variable which contain the result displayed in tab messages.
I do need a solution for this problem.
Please bring me your help.
Thanks for your help.
Tietie.
Thanks in advance.
Tietie
View 3 Replies
View Related
Apr 23, 2008
I am using Microsoft SQL 2005, I need to do a BULK INSERT from a .csv I just downloaded from paypal. I can't edit some of the columns that are given in the report. I am trying to load specific columns from the file.
bulk insert Orders
FROM 'C:Users*******DesktopDownloadURL123.csv'
WITH
(
FIELDTERMINATOR = ',',
FIRSTROW = 2,
ROWTERMINATOR = ''
)
So where would I state what column names (from row #1 on the .csv file) would be used into what specific column in the table.
I saw this on one of the sites which seemed to guide me towards the answer, but I failed.. here you go, it might help you:
FORMATFILE [ = 'format_file_path' ]
Specifies the full path of a format file. A format file describes the data file that contains stored responses created using the bcp utility on the same table or view. The format file should be used in cases in which:
The data file contains greater or fewer columns than the table or view.
The columns are in a different order.
The column delimiters vary.
There are other changes in the data format. Format files are usually created by using the bcp utility and modified with a text editor as needed. For more information, see bcp Utility.
View 12 Replies
View Related
Sep 6, 2015
I'm using Outlook 2010
My goal: I want to hide some text or table from inside the email message body. I don't want to attach a file with a table neither I want copy/paste it. I'd like to put that Excel table inside the message but the table is quite big.
Before I used Lotus Notes and it had the option to fold of hide some text from user. User could open when it wants but it will not take the space.
View 2 Replies
View Related
Nov 5, 2015
I am downloading a webpage as a text file in order to read a specific string to assign it as a variable/parameter in order to create an output file name. I would like to know how would I be able to look for a specific string and output as another variable for the rest of the package.
2015 Conforming Loan Limits
------------------------------------------------------------------------
o _Loan Limits for Calendar Year 2015--All Counties _[XLS]
</DataTools/Downloads/Documents/Conforming-Loan-Limits/FullCountyLoanLimitList2015_HERA-BASED_FINAL_FLAT.xlsx>_ ,
_[PDF]
</DataTools/Downloads/Documents/Conforming-Loan-Limits/FullCountyLoanLimitList2015_HERA-BASED_FINAL.pdf>_
​ o _List of 46 Counties with Increases in Loan Limits for 2015
[Code] ...
To explain it a more better way, I have a sample webpage text here. I should be searching for "FullCountyLoanLimitList" appended by the current year (like FullCountyLoanLimitList2015) and copy the entire file name in the text file and assign it to another variable so that I can download that specific file using WebClient connection.
View 4 Replies
View Related
Apr 26, 2014
I have two records...is having pid=10
idpid
10110
10210
1035
1046
1065
then i executed the below query..
update Child set pid=10 where id in (101,102)
the sql server showing message like
(2 row(s) affected) but as per data no records updated so i need to change this message type
if i ran the above update query the the result should be like
(0 row(s) affected)
is there any way to change this...
View 3 Replies
View Related
Jul 11, 2007
How to solve the problem of Warning message 'Fail Components' and 'redirect row' when doing text mining?
thanks
View 1 Replies
View Related
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
Jan 12, 2012
i attached adventure works in sql server 2008 and it showing as read only ,make it read write or remove read only tag from database.
View 11 Replies
View Related
Mar 24, 2015
How to identify whether the files are in read write or read only?
View 1 Replies
View Related
Aug 26, 2015
I'm trying to do Sharepoint DR with Log Shipping and every thing configured except one thing which is switch the WSS_Content (Standby /Read-Only) DB to be ready and Write.Â
I tried from
GUI or ALTER DATABASEÂ [WSS_Content]Â SET
READ_WRITEÂ WITHÂ NO_WAIT
but I received the below error:Â
Database WSS_Content is in Warm StandbyÂ
View 9 Replies
View Related
Jan 18, 2008
I have two database files, one .mdf and one .ndf. The creator of these files has marked them readonly. I want to "attach" these files to a new database, but cannot do so because they are read-only. I get this message:
Server: Msg 3415, Level 16, State 2, Line 1
Database 'TestSprintLD2' is read-only or has read-only files and must be made writable before it can be upgraded.
What command(s) are needed to make these files read_write?
thanks
View 7 Replies
View Related
Jul 23, 2007
In my SQL Server, I see the below message in the Application Event Viewer
"18265 :
Log backed up: Database: HSD, creation date(time): 2007/01/06(05:05:05), first LSN: 1439:495055:1, last LSN: 1439:496675:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'D:MSSQLBACKUPHSDHSD_tlog_200707141300.TRN'})."
When I save the application event viewer and open it in another server, I do not see the above message, instead I get the following message:
" Can't find or load message DLL. Message DLL must be in path or in current directory."
Any thoughts to overcome this problem is appreciated.
Thanks
Santhosh
View 3 Replies
View Related
Jun 27, 2014
i have a database which get refreshed every day from client's data . and we need to pull heavy data from them every day as reports . so only selects happens on that database.
we do daily population of some table in some other databases from this daily refreshed DB.
will read uncommitted or NOLOCK with select queries to retrieve data faster.
there will be no dirty read as there are NO DML operation in that database so for SELECT which happens concurrently on these tables , will NOLOCK work?
View 2 Replies
View Related
Aug 15, 2014
Can a user of db owner role of a database change the databse option to read only and read-write?If not what permission I need to grant to the user?
View 1 Replies
View Related
Jul 23, 2005
Is it possible to set READ UNCOMMITTED to a user connecting to an SQL2000 server instance? I understand this can be done via a front endapplication. But what I am looking to do is to assign this to aspecific user when they login to the server via any entry application.Can this be set with a trigger?
View 1 Replies
View Related