CREATE PROC dbo.ShowHierarchy
(
@Root int
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @EmpID int, @EmpName varchar(30)
SET @EmpName = (SELECT EmpName FROM dbo.Emp WHERE EmpID = @Root)
PRINT REPLICATE('-', @@NESTLEVEL * 4) + @EmpName
SET @EmpID = (SELECT MIN(EmpID) FROM dbo.Emp WHERE MgrID = @Root)
WHILE @EmpID IS NOT NULL
BEGIN
EXEC dbo.ShowHierarchy @EmpID
SET @EmpID = (SELECT MIN(EmpID) FROM dbo.Emp WHERE MgrID = @Root AND EmpID > @EmpID)
END
END
I wrote a stored procedure and at the bottom of SP I wrote
IF @@rowcount=1 return 0 else begin return 50002 end
I wanna have the value whether is 0 or 50002 value in Visual Basic.
How can I have this values in VB, I appreciate if you guys help me out
Thankx
using VB5, SQL 6.5 and ADO to connect how can I get SQL to send me a signal, flag, whatever when a stored procedure is finished running.
Let me explain... I exec a stored Proc from VB... no resultset returned since SQL does all the processing (moving data between tables, blah, blah, blah) and when it`s done, that`s it... however I would like SQL to send me something back to the front end app so that I can put a msgbox saying.. the sp has finished running.
Hai. Here i am sending my query.This is urgent to my job.Please give me solution as early as possible in SQL server.
Thanks. My query is.. Check for CD drive on your system.If drive available ,display the name of the CD and read the contents of the CD,and search for given file in CD. I want search this on local machine and on remote system.
I am having a very weird problem. I have the following expression =Val(Fields!test.Value) This will display the number if the number is greater than 0. So it will display any number above 0 and it won€™t display .05 Or .75 any idea?
Hello, I am working on some maintenance work. I need a Stored procedure to read all contents of OS and SQL server log. It has to accept filename as IN parameter. Please help me to solve this problem.
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
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?
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.
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?
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?
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
This morning I can not connect to our SQL Server 7.0 whatever from client or server. The error message which I list below:
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++ A connection could not be estabished to server--Timeout expired Please verfy SQL Server is running and check your SQL Server registration properties and try again. ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++
We use windows NT authentication. We did not do any change on NT. The SQL Server daily schedule job usally stoped at 10:00AM, but today from the Window NT Task Manager, we can see that the SQL Server is still running untill now.
hi, I have settup up sql mail and did the following: 1. created an E-mail account and configured Out look by creating a pop3 mail profile. tested it by sending and receiving mail, that is ook 2. I Created one domain account for MSsqlserver and Sql Agent service. both services use same account and start automatically in the control panel-services 3. I used the profile that I created in outlook to test the sql mail but got an error: Error 22030 : A MAPI error ( error number:273) occurred: MapiLogon Ex Failed due to MAPI Error 273: MAPI Logon Failed
I really do not know what went wrong. I followed the steps from bol and still having a problem. Am I missing something.
I do have a valid email account I do have a valid domain account I tested outlook using the email account and it worked. so why sql server does not recognise MAPI.
My next question, How to configure MAPI in Sql server if what I did was wrong.
Hi, I have 2 windows 2000 server in cluster with sql server 2000 enterprise edition installed. I have activated the Server-Requested Encryption by using the sql server network utility (Force Protocol Encryption). After this, I have stoped sql server service. But I can't start it at this moment. The error is: 19015: The encrypton is required but no available certificat has been found.
Hello, I am facing a huge problem in my sql server database using access as a front end.The main problem is trying to execute queries "views" ,since they reside on sql server now,and using variables or parameters in reports and forms to filter on this query. Ex. how can the following be implemented using the same query but in sql server? Access ------ SELECT MAT_Charts.YYYYMM FROM MAT_Charts WHERE ((([Area_Code] & "-" & [GROUP_CODE])=[Reports]![MAT_Chart_C1].[MAT_Key])) GROUP BY MAT_Charts.YYYYMM;
It is specifically this statement in which I am interested: [GROUP_CODE])=[Reports]![MAT_Chart_C1].[MAT_Key]))
I am getting error in sysindexes when i run dbcc checkdb on a production db. the error is Server: Msg 8928, Level 16, State 1, Line 1 please help me to remove this all the options of dbcc checkdb as well as table are not helping me
Hi! Can You tell me how can i fix this error: Cannot open database "DiaulusSimple" requested by the login. The login failed.Login failed for user 'DIAULUSASPNET'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Cannot open database "DiaulusSimple" requested by the login. The login failed.Login failed for user 'DIAULUSASPNET'.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I am using ASP.NET, SQLServer2005, Visual Studio 2005
looking for SQL Guru who can tell me what I'm doing wrong with the following VB executable which runs on the server, I'm getting the error, "cannot delete record database is read only." Seems straight forward but I can delete records from this table remotely via an active server page (asp) no problem.
Thank in Advance
Regards
Bob Cheeseman King Kommunications <http://www.kingkom.com> bob@kingkom.com <mailto:bob@kingkom.com>
Public Sub Main()
On Error GoTo skip
Dim stDocName As String Dim stQuoteName As String Dim objAccess As Object Dim myDoCmd As Object Dim dbs As Database Dim PrimaryRS As Recordset Dim location As String
Set dbs = OpenDatabase("NVO", dbDriverNoPrompt, False, "ODBC;DATABASE=NVO2000;DSN=NVO")
Set PrimaryRS = dbs.OpenRecordset("SELECT * FROM quotation_files_temp", dbOpenDynaset) stQuoteName = PrimaryRS!QuoteNum
ok when i upload my databases that i created in VS2005, they are read only. so i though something was just funny, so i installed sql managment studio on the server and attached the databases, and when i attached them there grey with (READ-ONLY) displayed... how can i get my DB's out of read only! i tryied going through the properties of the DB through MSSQL managenet studio but that only generates an error... any ideas!
Hi Friends, I have the text file in my server which is 21 MB size. i want to insert that text file into temporary table and then based on the conditions will insert the original table.But before inserting all the records in temporary table, i got the below error message but the backend process still running(inserting into temp table) The following error was encountered:
Read Timeout The system returned: [No Error] A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request. I am using the following code configuration section <sessionState timeout="600" /> <httpRuntime executionTimeout="110" maxRequestLength="21504" requestLengthDiskThreshold="80" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000" enableKernelOutputCache="true" enableVersionHeader="true" requireRootedSaveAsPath="true" enable="true" shutdownTimeout="90" delayNotificationTimeout="5" waitChangeNotification="0" maxWaitChangeNotification="0" enableHeaderChecking="true" sendCacheControlHeader="true" apartmentThreading="false" />
How to implement the page keep active while all the records are inserted into DB?
The new databound controls are great, but somehow doing the simpler things has gotten harder.The code is in a function that is passed pollid. I want to use SqlDataSource to get the smallest value of answerid where pollid = the value passed for pollid. For example:"Select top from PollAsnwers where pollid=" & PollId & " order by AnswerId" I can set up the SqlDataSource for a data reader to fill a GridView control, but that isn't what I want to do. In fact, I can't find anything on SqlDataSource that doesn't also involve the GridView control.I have so far:Dim myConnection As SqlConnectionDim myCommand As SqlCommandDim myReader As SqlDataReadermyConnection = New SqlConnection()myConnection.ConnectionString = ConfigurationManager.ConnectionStrings("UserPolls").ConnectionStringmyCommand = New SqlCommand()myCommand.CommandText = "Select top from PollAsnwers where pollid=" & PollId & " order by AnswerId"myCommand.CommandType = CommandType.TextmyCommand.Connection = myConnectionmyCommand.Connection.Open() Now assuming I have a single row of data, how do I read the value of Answerid? If I have this wrong, what should I have? Diane
getting this error after publishing my site to local IIS, then trying my signup page. Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. have tryed to change the attributes, still not working. have given write access to the APP_DATA folder from IIS, still not working. and i cannot delete the APP_DATA folder from IIS, it says it is being used by another process or program. how to fix this? and or delete the folder?
Hey , I have sql server 2000, and i am using Microsoft Application block. I have Transaction Like... SqlConnection conn = new SqlConnection(ASLConnectionString); conn.Open(); SqlTransaction Trans = conn.BeginTransaction(IsolationLevel.ReadUncommitted); But If i have another process that try to read the Table if that old transaction running.. it wouldn't Allow me to read the DATA. i tried Isolation level "snapshot" but that works under sql server 2005 only. so i can not use that. And i have some services that will run during day time. So if anybody have solution to read the data from table...from sql server 2000 even if another transaction is running? Please Give any guideline..Help will be appriciated.
Hi everyone, I have a table with a primary key called ID. My problem is that I can NOT set the Is Identity propertiy of ID to yes! How can I enable that field? or set it to yes?
I use MS Sql DataBase file (SQL 2005 )as the conneciton in my project.When I use GridView to update my database, it fail:The error message is :Failed to update database "D:DATAASPNETHEALTH8APP_DATADBHEALTH.MDF" because the database is read-only. What is the problem with it?
Hello everyone. I am to create a sample site using the club site example. I had a problem with the IIS but now it is solved. Now i copyied the site to the IIS and it is running. But i cannot access ASPNETDB.MDF. It keep saying that the database is read only... It is not read only!!! Can any one help me?? System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTNEOAPP_DATAASPNETDB.MDF" because the database is read-only. Thank you in advance. Iasonas