Code To Check If DB Is Online
Apr 4, 2008
I want to check whether or not a DB is online when a report is run. If it is offline I would like to display a friendly message.
Currently my users get error messages when they run a report against a database that is offline. They get incomplete reports if they run a report while the database is being restored.
How can I detect the state of the database and display the appropriate friendly message? Is there a property to check or an event where I should write some code?
I look forward to your response.
View 2 Replies
ADVERTISEMENT
Nov 15, 2007
I am sure that most of you will have seen this but for those of you who haven’t, its basically a dialog box where you dump you T-SQL and then tell it which system your using (ie. MS SQL). When you press the format button, it returns an almost perfectly formatted version. The link is:
http://www.sqlinform.com/
Hope it helps
Steve
View 5 Replies
View Related
Sep 30, 2007
Hi,
We have unreliable circuits connecting our office to remote sql servers. At our office I need to delete/insert a bunch of records from those remote locations. Since the connection is unreliable what is the best way to check if a server is available before executing delete/insert statements. A few points to consider:
1. I want this to be done in SQL
2. I have a cursor that cycles through a tabe that contains the name of the linked servers. The cursure is used to delete/insert a bunch of records from each remote server.
3. If one server is unavailable the stored proc should continue to the next sql server (next record in the cursor.)
Thanks,
Bradley
View 3 Replies
View Related
Nov 3, 2015
We have SQL cluster installed on top of windows cluster on VM environment. Node1 and Node2 under Windows Failover Cluster. SQL instance is currently on node2 the instance is up and running, but SQL Cluster service remains online pending and it restarts the instance on every 5 minutes.
SQL Browser service are running successfully.TCP/IP ports are enabled and configured.If we start the SQL server agent it is on for seconds and stopped immediately  .Cluster Service is attempt to connect to the SQL service every few minutes (setting in SQL cluster resource) for the IsAlive check, if this fails then the SQL resource is restarted even if the instance was online. Hope this is what happening exactly.
[sqsrvres] ODBC Error: [08001] [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (268435455)
00001024.00053314::2015/10/30-19:57:50.772 ERRÂ Â [RES] SQL Server <SQL Server (SIMAH_COMMDB)>: [sqsrvres] ODBC Error: [HYT00] [Microsoft][SQL Server Native Client 11.0]Login timeout expired (0)
00001024.00053314::2015/10/30-19:57:50.772 ERRÂ Â [RES] SQL Server <SQL Server (SIMAH_COMMDB)>: [sqsrvres] ODBC Error: [08001] [Microsoft][SQL Server
Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books
Online. (268435455)
00001024.00053314::2015/10/30-19:57:50.772 INFOÂ [RES] SQL Server <SQL Server (SIMAH_COMMDB)>: [sqsrvres] Could not connect to SQL Server (rc -1
View 5 Replies
View Related
Sep 1, 2006
Hello,I Have a code:<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" InsertCommand="INSERT INTO [shop_clients] ([ID], [IMIE]) VALUES (@ID, @IMIE)"> <InsertParameters> <asp:Parameter Name="ID" Type="Int32" /> <asp:Parameter Name="IMIE" Type="String" /> </InsertParameters> </asp:SqlDataSource> SO this code It will allow me insert to database SQL textbox - name ?If yes How I can:If I click the button My textbox - name, insert to databasePlease me help :)
View 1 Replies
View Related
Sep 7, 2000
Can anyone tell me what is wrong with this line of code..
I am missing someting on both line of code
exec ("print 'DBCC INPUTBUFFER FOR SPID " + @spid + "'")
exec ("dbcc inputbuffer (" + @spid + ")")
View 2 Replies
View Related
Jul 23, 2005
Hi,I want to create a tool that run over Windows Server 2003 and checksthe sql server 2000 edition (Enterprise, Standard, Personal,Developer).I know I can do from the query analyzer - "Select @@version".But how can I do it from code, is there a WMI API that can tell mewhat's the edition?Thanks,Koby
View 4 Replies
View Related
Aug 9, 2013
I want to check if a table is empty using query code?
How to do this?
View 4 Replies
View Related
Jan 7, 2008
How to query the database to see if a job is still running?
View 1 Replies
View Related
May 20, 2015
I have multiple ODBC connection and how to check all connection automatically during routine check by using batch file.
View 5 Replies
View Related
Mar 16, 2006
Hi
I have made a small mistake while restoring the DB I selected the 3rd option in the em
Leave the DB read-only and able to restore additional transactional logs
I have just realized that all I have is a complete back up to restore & no transaction logss...
I see the Db in a Read-only state & when I try to get it online It says
Error 5063 : Db is a warm standby. A warm standby db is read-only
Alter DB statement failed.
sp_dboption command failed
Please Help
View 5 Replies
View Related
Jul 27, 2006
Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value
for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next
Main = DTSTaskExecResult_Success
End Function
This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)
Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:
public Sub Main()
...
Dts.TaskResult = Dts.Results.Success
End Class
I get the following error when I attempt to compile this:
Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.
I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.
- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).
Given this statement:
dim cn, i, rs, sSQL
I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!
View 7 Replies
View Related
Mar 28, 2007
Dear Friends,
I am having 2 Tables.
Table 1: AddressBook
Fields --> User Name, Address, CountryCode
Table 2: Country
Fields --> Country Code, Country Name
Step 1 : I have created a Cube with these two tables using SSAS.
Step 2 : I have created a report in SSRS showing Address list.
The Column in the report are User Name, Address, Country Name
But I have no idea, how to convert this Country Code to Country name.
I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]
Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.
Thanks in advance.
Regards
Ramakrishnan
Singapore
28 March 2007
View 4 Replies
View Related
Jan 8, 2008
I know MMORPGs take tons of special servers, but what about a simple 2D minorly-multiplayer online game, say with 3-5 players- could that be run through an SQL database or is it still too slow?
View 2 Replies
View Related
Jan 21, 2004
Hi,
I'm looking for a good reference guide online as I am more used to mysql (and stil quite limited vocab at that)
I create table outside of a database by accident and I'm now looking for the sql syntaxt for moving tables, but I can't find it anywhere?
most simple guides don't seem to provide the syntax to do this. :(
View 11 Replies
View Related
Sep 29, 1999
Can someone share with me their experience or thougts on whether it is better to :
1) backup db to the disk first, then to the tape OR
2) use online backup which backup the database on realtime basis to the tape.
Any excellent software for online backup?
View 1 Replies
View Related
Sep 28, 2005
Can anyone tell me how I would go about making my SQL server accessable from the Internet, or know of any good tutorials to get me started, I haven't had much luck looking on google.
I need to access an SQL database from one server on another server for a web application.
Thanks
View 4 Replies
View Related
Jul 1, 2007
Dear fellows,
I need online database tutor whom I can pay and he makes my database concepts from scratch. Is there any such facility available
Regards
View 4 Replies
View Related
May 16, 2008
Hi,
I have started to learn SQL, I need to practise those commands through online sql interpreter. Is there any web page available to do so? or where can i down load it for free?
View 5 Replies
View Related
Aug 10, 2005
How do you use BOL? I've heard time again that there is much info in BOL but when i look at it it seems too brief and not detailed. I find it hard to find what i'm looking for anyway. How do you use it?
Thanks!
View 13 Replies
View Related
Dec 15, 2007
Hello all! Im new to SQL2005. If it is possible to see realtime graphs from tables? For example current sales result?
Thanx
View 1 Replies
View Related
Jul 20, 2005
Dear Friends,I don't know anybody has asked this question before or not.But I needa support urgently.How to take online backup in MS Sql server 2000.ThanksArijit Chatterjee
View 2 Replies
View Related
May 23, 2007
Hi need to something like this:
"alter database modify file (name=<name>, ONLINE)",
but it isn't possible.
Here what I did:
alter database bdj add file (name ='bdjfg1', filename='d:db
djfg1.ndf' )
to filegroup bdjfg;
alter database bdj modify file (name='bdjfg1', OFFLINE);
alter database bdj modify file (name ='bdjfg1', filename='d:db
ewdestdjfg1.ndf' );
--Msg 5056, Level 16, State 4, Line 1
--Cannot add, remove, or modify a file in filegroup 'bdjfg' because
the filegroup is offline.
alter database bdj modify filegroup bdjfg READWRITE;
--Msg 5056, Level 16, State 3, Line 1
--Cannot add, remove, or modify a file in filegroup 'bdjfg' because
the filegroup is offline.
Yes, yes and should have read the cautions section saying:
"Use this option only when the file is corrupted and can be restored. A file set to OFFLINE can only
be set online by restoring the file from backup. For more information about restoring a single file,
see RESTORE (Transact-SQL)."
But I have not an backup of the datafile, but I have the datafile itself!
What can I do to get it online again, the old location could be fine, but it would be better on an new location (thats is the reason for all the trouble, the original drive has not much space left, so I wanted to move the datafile)
What can I do, HELP
/Bjorn
View 1 Replies
View Related
Apr 11, 2005
Hi all; I am trying to login to an online sql database from enterprise manager;
First of all is this possible and second of all, how do I go about doing it from enterprise manager (by the way I am using MS SQL 2000)
THanks for any assistance
View 1 Replies
View Related
May 10, 2001
Hi,
I hope i'm in the right forum. Is there a way to create a DB diagram schema via ASP/HTML and publish it on-line - keeping it up-to-date?
I want to at least output a diagram schema to HTML format? Any ideas. TIA!
View 2 Replies
View Related
Jun 10, 2005
We have just release a free Online SQL Formatter
which can beautify different sql dialects for you on the fly,
and translate to other languages such as C#, Java,Delphi with many format options.
Try it here:
http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm
View 14 Replies
View Related
Aug 2, 2002
Hi All...
Can anyone guide me to a place where I can download some Tutorials / Books (Not that new) covering Microsoft SQL 2000 essentials ? I tried to find here, but artices are too advanced for me.. I need something that covers the Basic and that could be used as a small reference/guide while I am learing...
Thanks to ALL
View 1 Replies
View Related
May 3, 2001
Does anyone know which SP to use to get the list of available servers?
I want to call it from a VB app via ADO to provide the user with a choice of servers available.
View 1 Replies
View Related
Apr 20, 2006
I've just started with a company that had a web developer in to set up their site. She set it up with Coldfusion and MS SQL Server, uploaded the whole thing to their provider, then disappeared. Then the whole thing got dumped in my lap, and I'm pretty new to both SQL Server and Coldfusion.
My first question is, how can I access the SQL Server database online? It's somewhere on the web host's site, and I have the name of it and the password, but I have no clue how I'm supposed to get a look at the thing. Is there a file I should be able to find? Can anyone provide a clue?
Thanks!
April
View 5 Replies
View Related
Dec 21, 2005
Hi,
Is there any method to get an historical log where appears the database status (Online|offline) ?
Regards.
View 1 Replies
View Related
Sep 14, 2006
Dear all
Where can I download Sql Server Books Online for any versions of 6.5 or 6.0 or 4.
thanks
View 1 Replies
View Related
Aug 10, 2015
When I first opened Books Online, I chose the option to run the documentation online rather than locally; now I would like to change that to locally.
View 3 Replies
View Related
May 22, 2007
Anyone using the ONLINE=ON option on large DB's? We have a db of 5 GB and we are doing some load testing for SQL 2005. We are modifying the Index scripts for the upgrade. We will run a load with the ONLINE=ON option but just wanted to find out if anyone already is doing it on a similar scale db and has seen any issues?
Also, we have auto-update stats off at the DB level. Does setting the ONLINE=ON require turning this auto-update stats to ON too? I didnt see anything to that effect in BOL, so was wondering.
Thanks for any feedback.
Dinakar Nethi
SQL Server MVP
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
View 7 Replies
View Related