sql-server-2005

ADO Connection Timeout problem

让人想犯罪 __ 提交于 2019-12-31 03:11:14
问题 Using TADOConnection class to connect to SQL server 2005 db. Having ConnectionTimeOut := 5; // seconds. Trying to open the connection synchronously. When the server is available and running, the connection time out works fine. If the server is not available or network connection is lost, then attempting to open a connection waits for more than 5 seconds (may be 20 secs). Is there any property or method that needs to be set to influence this behavior? 回答1: No, it's enough to set the

How to set SQL Server 2005 Job CmdExec Timeout

。_饼干妹妹 提交于 2019-12-31 02:56:45
问题 I have a job setup in SQL Server 2005 which has an Operating System (CmdExec) step. The step calls a program which can take a long time to run. I see that if the program takes longer than 1 minute 40 seconds to respond the step fails with an error message "The operation has timed out". The program actually continues to run and generates the desired results. How can I set the timeout period for the step in this job. Alternatively if there is a way to set the timeout for the entire job that

Convert integer to a list of week days

假装没事ソ 提交于 2019-12-31 02:56:07
问题 I have an integer stored in a database (SQLAgent Frequency Interval) This integer is actually the sum of the selected days of the week that the schedule is to run The possible values are any combination of these values Sunday =1 Monday = 2 Tuesday =4 Wednesday= 8 Thursday = 16 Friday = 32 Saturday =64 ex 65 means that the schedule should run on Saturday and Sunday My problem is that I need to represent these values as the text "Saturday" and "Sunday" when given 65 and I am trying to do this

Error Handling in Classic Asp without timeout error

安稳与你 提交于 2019-12-31 02:36:09
问题 In classic asp page, i need to catch the error description and insert into a table in the database. when i use 'on error resume next', i am getting a timeout error as follows: The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools Please help me to catch the exception and insert into database. 回答1: I believe your question is "How do I

How to protect the sql server 2005 MDF file

吃可爱长大的小学妹 提交于 2019-12-31 01:23:25
问题 How to set the Password for sql server 2005 MDF file. Becoz i want to give the trail package to the client,package including the MDF. After installing the package, the MDF will be placed in C drive, user data will store in MDF file through the application. but not allow to attach that MDF file using sql server in that system. 回答1: If someone is sysadmin of an instance, one will be able to attach the mdf regardless of what you do. If you want to protect data from sysadmin, there are some

SQL recursive query

白昼怎懂夜的黑 提交于 2019-12-30 18:48:44
问题 I have a Table Category, 1) Id 2) CategoryName 3) CategoryMaster with data as: 1 Computers 0 2 Software 1 3 Multimedia 1 4 Animation 3 5 Health 0 6 Healthsub 5 and i have created recursive query as: ;WITH CategoryTree AS ( SELECT *, CAST(NULL AS VARCHAR(50)) AS ParentName, 0 AS Generation FROM dbo.Category WHERE CategoryName = 'Computers' UNION ALL SELECT Cat.*,CategoryTree.CategoryName AS ParentName, Generation + 1 FROM dbo.Category AS Cat INNER JOIN CategoryTree ON Cat.CategoryMaster =

Disable “save” prompt in SQL Server Management Studio 2005

陌路散爱 提交于 2019-12-30 17:20:47
问题 I just want to close all my query windows without saving, but SSMS always prompts me and I can't find the turn-off switch. Any ideas? 回答1: There isn't an off switch - currently! Microsoft are reluctant to add one, but you can perhaps join the growing throng of people who are trying to persuade them: prompting-for-modified-windows-when-closing-ssms-should-be-optional 回答2: In SQL Server Management Studio 2016 you can unchecked the Prompt to save unsaved T-SQL query windows on close : The option

How to convert rows values into column in sql server 2005

荒凉一梦 提交于 2019-12-30 13:25:10
问题 How to convert row into column.I have following result set. UserID VendorName QuestionText AnswerText 1 KK abc1 ans1 1 KK abc2 ans2 1 KK abc3 ans3 2 JJ abc1 ans2 2 JJ abc2 ans3 2 JJ abc3 ans1 OUTPUT should be: UserID VendorName abc1 abc2 abc3 1 KK ans1 ans2 ans3 2 JJ ans2 ans3 ans1 Thanks. 回答1: SELECT UserID, VendorName, [abc1], [abc2], [abc3] FROM Questions PIVOT (MAX(AnswerText) FOR QuestionText IN ([abc1], [abc2], [abc3]) ) AS pvt 回答2: SELECT grsid,contactid, [1] rejectcode, [12]

Searching in SQL Management Studio 2005

六月ゝ 毕业季﹏ 提交于 2019-12-30 12:16:27
问题 Is there a way to search for text within stored procedures? For example I want to find out if a particular table is being referenced by any stored procedure. 回答1: SELECT OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id) FROM sys.sql_modules WHERE definition like '%whatever%' syscomments is legacy and splits the definition into nvarchar 4000 chunks thus risking not finding what you want. The same applies to INFORMATION_SCHEMA.ROUTINES 回答2: Red Gate has a free tool called Sql Search

Sql Server - Avoid deferred compilation

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-30 11:23:21
问题 I have an application that queries and updates two databases at the same time (different from each other) and it has already around 10 to 15 years of usage. So I would like to start clearing up the garbage from them. One of the things that I want to do is to remove all the stored procedures that are in database B that by mistake were created there (because they had to go in database A). If I do one by one, is easy because I can tell if the sp uses a table that is not in that database. But I