How To Read SQL Server Log?
Jan 13, 2008is there any way to view and read the sql server log using T-SQL or .NET form?
View 2 Repliesis there any way to view and read the sql server log using T-SQL or .NET form?
View 2 Repliesi 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 RelatedOBJECTIVE: 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.
How to identify whether the files are in read write or read only?
View 1 Replies View RelatedI'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Â
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
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?
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 RelatedIs 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 RelatedHi All,
Please some one help me...
I have to insert a csv into one table in sql server. But the problem is the file is in one server and SQL SERVER 2005 is in other server..
how do i insert the file....
please help me.....
OK, I'm using VS2003 and I'm having trouble. The page works perfectly when I created it with WebMatrix but I want to learn more about creating code behind pages and this page doesn't work. I think it has some things to do with Query builder but I can't seem to get change outside "please register". I have the table populated and it is not coming back with "login successful" or "password wrong" when I've entered correct information. Enclosed is what I've done in VS2003. Can you see where my error is? Any help would be greatly appreciated.
Thanks again.
Imports System.data.sqlclient
Imports System.Data
Public Class login2
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "server=LAWORKSTATION;user id=sa;database=test;password=t3st"
'
'SqlCommand1
'
Me.SqlCommand1.CommandText = "SELECT pass FROM Customer WHERE (email = 'txtusername.text')"
Me.SqlCommand1.Connection = Me.SqlConnection1
End Sub
Protected WithEvents lblUsername As System.Web.UI.WebControls.Label
Protected WithEvents lblPassword As System.Web.UI.WebControls.Label
Protected WithEvents txtUsername As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPassword As System.Web.UI.WebControls.TextBox
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
SqlConnection1.Open()
Dim dr As SqlDataReader = SqlCommand1.ExecuteReader
If dr.Read() Then
If dr("password").ToString = txtPassword.Text Then
lblMessage.Text = "login successful"
Else
lblMessage.Text = "Wrong password"
End If
Else
lblMessage.Text = "Please register"
End If
dr.Close()
SqlConnection1.Close()
End Sub
End Class
if it is possible to run a distributed query against 2000 from 2005, what would the OPENDATASOURCE parameters look like? I'd like to be able to pivot without copying my older 2000 db to 2005 or using linked servers..
For reference, here's an example of a distrib query that reads excel...
ie SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C: estxltest.xls;Extended Properties=Excel 8.0')...[Customers$]
Hi Guru's,I want to show images in my webforms, but whitout any succes....... , hope some can tell me why as base I've used exactly the same script as defined in the article http://www.dotnetbips.com/displayarticle.aspx?id=101 Maybe its because some of the HTML is incorrect ?<itemtemplate> <asp:image id="img" runat= server></asp:image></itemtemplate>Please , a need some assitance hereregardsS
View 1 Replies View RelatedHi, Anybody has an example of reading a csv comma delimited file and insert the fields into a datatable?Thanks
View 2 Replies View RelatedHi:
I have a couple enter prise SQL 2000 servers, each might contain around 800 customer databases. each of those 800 databases has its own sql standard login and password and corresponding permission on table select/update/delete and proc exec rights.
I want to create a sever level single login and password, which could read-only those 800 databases all tables only data. Those 800 databases are not always the same, some might be dropped out, new might be added.
If this is impossible, what might be the alternative?
thanks
-D :)
Hi,
I wanted to read the transaction log...is there a way??? I want to know the command executed from the transaction logs.
DBCC TRACEON (3604)
select * from ::fn_dblog(1,null)
DBCC LOG (test,-1)
Anything else apart from these??
Regards,
Asha
Is it possible to make a table (or set of tables) within a SQL Server database read only (still granting the db_datawriter fixed database role to database users) without dropping and recreating the db_datawriter database role?
View 1 Replies View RelatedHello!
My real problem is that i want to read an image from an Sql Server DB, resize them and send them, all this through a Web Service. I decide to split my problem in four steps:
1 - read image from Database
2 - Resize that image
3 - Send her back to the DB
4 - Send the image throw a web service after he use a dataset to read the data from the DB.
i try to read the database with this function
Code Snippet
public System.Drawing.Image ReadImgFromDB(Int64 imageID)
{
System.Drawing.Image image = null;
using (SqlConnection conn = new SqlConnection())
{
string connString = WebConfigurationManager.ConnectionStrings
["StringCC"].ConnectionString;
conn.ConnectionString = connString;
SqlCommand myCommand = new SqlCommand(
"SELECT Pic FROM Images WHERE ID='"+ imageID +"'", conn);
conn.Open();
byte[] imageData = (byte[])myCommand.ExecuteScalar();
System.IO.MemoryStream memStream = new System.IO.MemoryStream(imageData);
image = System.Drawing.Image.FromStream(memStream);
}
return image;
}
i introduce a valid image ID and i get this message
--- " System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Service.ReadImgFromDB(Int64 chaveI) in e:Web ProjectsWSserviceApp_CodeService.cs:line 48"-----
line 48: "image = System.Drawing.Image.FromStream(memStream);"
Thank you!
I have a Login that I setup in SQL Server 2005. The only database roles given to the login are db_datareader and public. On SQL 2000 these permissions are sufficient to allow me to setup a read only ODBC connection using this login and creating an import table in Access. When using the login in SQL 2005 and creating an import table, I am able to edit the underlying data, something I am not able to do with a SQL 2000 ODBC connection. Is there something in SQL 2005 that I am unaware of that would allow this login to modify (update) the table?
View 6 Replies View RelatedHere is my task I am storing pdf's in sql server. I would like to retrieve the binary data from sql server and write the pdf content into an existing aspx page to the appropriate pageview section. What is the best way to handle this. The code works below but it loads a new browser with the content. I need it to appear in it's tabbed section in the original aspx file. Any assistance you can give me would be greatly appreciated.
Thanks Jerry
oSQLConn.Open()Dim myreader As SqlDataReader
myreader = myCommand.ExecuteReader
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Do While (myreader.Read())
Response.ContentType = ("application/pdf")Response.BinaryWrite(myreader.Item("img_content"))
Loop
I have SQL Server 7 database & I need to create some interface between users & database to let users see what is in the database, but not let them change or destroy data. Do I need to create some other database in-between users & the original database? Users can't program & want access to all data.management doesn't want to create a replication of the database. They want to let users have access through MS Word or Access. What could you advise me?
View 1 Replies View RelatedI have a few servers registered in my Enterprise Manager which I am managing. Can I see the server error log files for these servers?
Any help is greatly appreciated.
Hi,
I have an issue with an application, and i want to know what sql queries are done by this application. So i need to read the .ldf file, i have do some search on google, but i find nothing thant can be relevant.
Hi,
How can I provide a user read only access to all the databases on the server. I have 15 databases on the server. I know I can give db_datareader access in each database individually but that is time consuming and I have 10 servers for this to be done.
thanks in advance.
Is it possibel to run a DTS job to read a file from unix server?
View 4 Replies View Relatedhi ,
how to read the transation log files in sql server 2005, any body can help me........
Nageswar.V
I was wondering how can I read log file in a sql sever 2k5 database??
I mean, I want to check out every query since the selects until those that change server configuration, How can I do it without needing install a third-party software??
Keep in mynd that I need to know: the query (e.g.elect * from table_name) , source , date , application.
Best Regards
Joseph
Hi all,
How to Open Or read SQL Server log file .ldf
When ever we create database from sql server, it's create two file. (1) .mdf (2) .ldf.
I want to see what's available inside the .ldf file.
Thanks,
Ashok
Newbee question: I am trying to use some of the "101" samples in VS 2005 with SQL Server 2005. These samples use SQL server express MDF files.
The error is: "... you cannont open a database that is incompatible with this version of sqlservr.ext. You must re-create the database."
Do I need to install SQL server express? What are the issues with installing express when I am already running SQL Server 2005?
How do I update or "re-create" the express MDF database file in SQL Server 2005?
Thanks!
hello.
i have a _CommandPtr that has the type CommandTypeEnum::adCmdTex, and the CommandText a query("Select * from Table_1") and this select returns one row that has a binary data in it.
Code Block
_CommandPtr pCommand;
//Create the C++ ADO Command Object
pCommand.CreateInstance(__uuidof(Command));
pCommand->ActiveConnection = this->pConnection;
//Make the ADO C++ command object to accept stored procedure
pCommand->CommandType = CommandTypeEnum::adCmdText;
//Tell the name of the Stored Procedure to the command object
pCommand->CommandText = _bstr_t("select * from Table_1");
//get recordset
pRecordset = pCommand->Execute(NULL,NULL,CommandTypeEnum::adCmdText);
BYTE* buffer = NULL;
if(pRecordset != NULL)
{
while (!pRecordset->GetEndOfFile())
{
VARIANT var = pRecordset->Fields->GetItem("test")->Value;
void * pData = NULL;
SafeArrayAccessData(var.parray, &pData);
long size = GetArraySize(var, NULL);
buffer = new BYTE[size];
memcpy(buffer, pData, size);
SafeArrayUnaccessData(var.parray);
pRecordset->MoveNext();
}
pRecordset->Close();
}
where:
Code Block
long GetArraySize(const VARIANT& var, long * nElems)
{
if ( !(var.vt & VT_ARRAY) ) return -1;
long size = 0;
long dims = SafeArrayGetDim(var.parray);
long elemSize = SafeArrayGetElemsize(var.parray);
long elems = 1;
for ( long i=1; i <= dims; i++ )
{
long lbound, ubound;
SafeArrayGetLBound(var.parray, i, &lbound);
SafeArrayGetUBound(var.parray, i, &ubound);
elems *= (ubound - lbound + 1);
}
if ( nElems ) *nElems = elems;
size = elems*elemSize;
return size;
}
I enter in VARIANT var = pRecordset..... and if gives me a value... but when I put it in Memory explorer in VS, i only see this data " fe ee fe ee fe ee fe ee fe ee fe ee fe ee ...fe ee" and of course it brakes at
SafeArrayGetLBound(var.parray, i, &lbound);
Can someone tell me where I am doing a very bad thing?
P.S. I was able to read the binary data from the server using C#.NET 2.0.
I am getting this error after Litespeed installed:
Error Msg: SQL Server could not read the registry value: HKLMSoftwareImcedaSQLLitespeedexepath.
Check that the value exists, and that the SQL Server service account has full access to this keyºlue.
(11200)
Anyone gotta help here, thanks a lot.
I have an ORACLE server say "A". I have a SQL Server named "B". In SQL Server I have a table named "test" who contains only one field named "aa" which is "BIT" type field. I want to query this table of "B" from "A" interface through Oracle's DB Link and ODBC dsn for Sql Server. But it gives error. If I changed the data type of field "aa" to "int", then it reads easily. Please suggest.
View 7 Replies View RelatedHi Guys,
I've been strugling with this problem all morning today.
Basically I store images in SQL Server 2000 database and then whould like to show them with
<img src="viewImage.aspx?image_id=10" border=1>
My table structure is setup this way
TABLE [userImages] (
[imageFilename] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageContentType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageFileSize] [bigint] NULL ,
[imageFileImage] [image] NULL )
and in viewImage.aspx I have:
if (dr.Read())
{
Response.ContentType = dr.GetString(dr.GetOrdinal("imageContentType"));
Response.BinaryWrite( (byte[]) dr["imageFileImage"] );
}
I have no prolems retrieving the data from DB. But the image does not display(in IE it shows a broken link image)
What's even more puzzling is I CAN display the same image from HDD like so:
FileStream fs = File.OpenRead("D:\my_image.png");
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(buffer);
Am I missing something very obvious. I tried playing around with different ContentType's same result.
In my case I am forced to store images in the DB.
I've seen other examples on the net and theirs work. Please help.
Sincerely,
Vlad Orlovsky