.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

How To Check SQL SERVER Uptime Through T-SQL

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :Sql Server
 
logon to SQL Server management studio and connect to the master database instance   The after that you run this script against the master database instance only...   Highlighted Below:   SQLScript: SET NOCOUNT ONDECLARE @crdate DATETIME, @hr VARCHAR(50), @min VARCHAR(5)SELECT @crdate=crdate FROM sysdatabases WHERE NAME='tempdb'SELECT @hr=(DATEDIFF ( mi, @crdate,GETDATE()))/60IF ((DATEDIFF ( mi, @crdate,GETDATE()))/60)=0SELECT @min=(DATEDIFF ( mi, @crdate,GETDATE()))ELSESELECT @min=(DATEDIFF ( mi, @crdate,GETDATE()))-((DATEDIFF( mi, @crdate,GETDATE()))/60)*60PRINT 'SQL Server "' + CONVERT(VARCHAR(20),SERVERPROPERTY('SERVERNAME'))+'" is Online for the past '+@hr+' hours & '+@min+' minutes'IF NOT EXISTS (SELECT 1 FROM master.dbo.sysprocesses WHERE program_name = N'SQLAgent - Generic Refresher')BEGINPRINT 'SQL Server is running but SQL Server Agent <<NOT>> running'ENDELSE BEGINPRINT 'SQL Server and SQL Server Agent both are running'END


View Complete Post


More Related Resource Links

How can i check if record already exist in sql-server database ...

  
How can i check if record already exist in sql-server database ...

How to check effective permissions for a user or group for a SQL server object or whole server?

  
Guys, How do I see effective permissions for a user or group for a SQL server object or whole server? For example, a user is not listed in security/logins, but he is a member of few groups and some of them have assigned permissions on SQL server (again either directly or through membership in other groups) Even when I select an object (a table), check properties/permission – it doesn’t let me select any principal, except those listed on security/logins… Anyway, what is the right way to see effective permissions for a user or group? Sorry for asking such a simple question, I’ve searched but found nothing relevant.

Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential cau

  
Attempting to upgrade from SQL 2005 EE to SQL 2008 EE on Vmware ESX 3.5 virtual server. below is info from Detail.txt related to successful install with failures... 2010-09-02 13:50:46 Slp: Sco: Attempting to check if file 'D:\Data\MSSQL.1\MSSQL\LOG\ERRORLOG' exists 2010-09-02 13:50:46 Slp: Sco: Returning security descriptor O:BAG:SYD:AI(A;ID;FA;;;S-1-5-21-3788118842-658835432-3441893140-1006)(A;ID;FA;;;S-1-5-21-3788118842-658835432-3441893140-1007)(A;ID;FA;;;BA)(A;ID;FA;;;SY)S:AI(AU;IDFA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD) 2010-09-02 13:50:46 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC. 2010-09-02 13:50:46 Slp: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes. 2010-09-02 13:50:46 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC. 2010-09-02 13:50:46 Slp: Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineConfigException: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes. 2010-09-02 13:50:46 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceBase.WaitSqlServerStart(Process processSql) 2010-09-02 13:50:46 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceSCM.StartSqlServer(St

Error Message: The attempt to connect to the report server failed. Check your connection informatio

  
I have a web page that contains a ReportViewer control.  I am trying to display a report, which is an .rdl file located on the SSRS server, in this ReportViewer control.  I have set the ReportPath and ReportServerUrl correctly.  I am getting an error message. Am I suppose to use an .rdlc file rather than a .rdl file?  Does the web server configuration need to use a certain account?  I am getting the following error message: The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version. The request failed with HTTP status 404: Not Found.

SQL Server 2005 - Check if Trace Flag is enabled?

  

Hi all,

never encountered trace flags before, but due to a problem in one of our applications I was asked if we activated a hotfix by enabling two trace flags.

Is there a possibility to check, if the trace flags are enabled?

I don't have the permission to execute anything on our SQL Server so I cannot run the DBCC TRACEON command.

Other question: by enabling a trace flag is there any risk to it? We have a productive environment and at the end of the month there are lots of reports running, so I don't want to do any changes to the system that might cause a problem.

Thanks for your suggestions

Gáski


How to check for file exists on remote server in ssrs 2008?

  
I have a report that needs to display images that are stored on a remote web server. The problem is that I also need to check if the file exists first otherwise I get those annoying image not found red X's.

I tried entering the code at the bottom in the custom code section of the report which works if I run it on my local machine however it doesn't work in SSRS 2008. After doing a little trial and error I found it seems to be failing on the first line in the function,

Dim request = System.Net.WebRequest.Create(New Uri (fileURL))

Is there some specific permissions or configuration change needed on the SSRS2008 server for this code to work? Or is there a better way to do this?

Thanks,
Robert


Public Function CheckRemoteURL(ByVal fileURL As String) As String
Dim request = System.Net.WebRequest.Create(New Uri (fileURL))
request.Method = "HEAD"

Dim returnURL = ""

Try
Dim response = request.GetResponse()
returnURL = fileURL
Catch ex As Exception
returnURL =""
End Try

Return returnURL
End Function

Check if my sql server is not functioning properly

  

hello,

how can i know how my sql server is performing and how to know if it is freezing or is not functioning properly

thxs in advance


CHeck to see if file exists on Server before backup

  

Hello,

  I want to check first to see ifthe xyz.bak file exsits before I perform a backup.

 

Thanks


How to check (login Credentials) user name and password to access sharepoint server 2007 programmati

  
my issue is...

while user entered his/her Username:xyz
                                      password:abcd
i need to check programmatically either username & password exists ot not in sharepoint server 2007 from windows form application.

and i know how to check username,but i don't know how to check password.

you can check username in below ways..

 SPSite SharepointSiteObj = new SPSite(SiteUrl);
 SPWeb SharepointWebObj = SharepointSiteObj.OpenWeb("/");

 SPUserToken token=SharepointWebObj.AllUsers[userName]

from this i can get user name..

BUT I DON'T KNOW HOW TO CHECK USER PASSWORD....

PLEASE GIVE YOUR VALUBLE SUGGESTIONS AND SOME COADING..

THANKS FOR ANY HELP:
jilani

Unable to upgrade from SQL Server 2005 to SQL Server 2008 due to Reporting Server check failure

  
Hi all,

We were trying to upgrade our SQL Server 2005 tp SQL Server 2008, and bumped into some problem with the reporting server check.

Here were the environmental details:
- Windows Vista SP2 32-bit
- SQL Server 2005 (v 9.0.3077)
- Microsoft SQL Server 2008 Upgrade Advisor v 10.00.1600.22

While performing the Microsoft SQL Server Upgrade Advisor, it reported these problems on the Reporting Service:
PreUpgrade "The system cannot find the file specified." RSVDIRSEXIST
PreUpgrade "The system cannot find the file specified." RSIPADDRESSRESTRICTIONS
PreUpgrade "The system cannot find the file specified." RSCLIENTCERTIFICATES
PreUpgrade "The system cannot find the file specified." RSUSESIIS5
PreUpgrade "The system cannot find the file specified." RSIIS7BACKCOMPAT
PreUp

Simple Database connection check to seee if the database server is up and running using linq

  

I am using Linq

Before i start executing my query, want to check if the database connection is being established, i.e if the database server is up and running.

Incase database is down, display appropriate error message?

How can i do that?

 


How to check why restore job of log shipping has failed in SQL Server 2005?

  
I'm suspecting that the restore job of log shipping has failed in SQL Server 2005 because the LSN chain is broken.  How can I verify my suspicion?

SQL Server intallation -- Edition Change Check(warning)

  

I have 10 sql server instance in one single node cluster, 2 of them has been upgraded to sp4, the rest 8 is sp2. I uninstalled one of sql server instance, and recreate a new instance.

During sql server 2005 setup system configuration check, I got a message

" Edition Change Check (Warning)

To change an existing instance of Microsoft SQL Server 2005 to a different edition of SQL Server 2005, you must run SQL Server 2005 Setup from the command prompt and include the SKUUPGRADE=1 parameter."

I check the forum, and got this thread:

http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/ac8fb207-0773-448c-85bc-0770dc07ee22

I would like to know:

is it true that we have to install all instance before we do patch? otherwise, we will get the above message when try to install new instance?

If I ignore the warning, continue the install, what possible result will get? I can not try in my environment, since I do not want to mess up with the rest 9 instance.

Thanks

 

 

 

 

 

 


PAULqaz

How to check phone in SQL server 2005

  

hi ,

How to check phone in SQL server 2005

Example :

 

phone char(10) not null -- phone include : number

if len(convert(int,phone)) <> 10

 print 'Phone include 10 number'

if convert(int,phone) <> [0-9]

 print 'Phone not char'

 

It`s look like . But it`s not worked

Can you help me about this trouble ?



Using a CompareValidator to check input is a valid date

  
The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend