sql-server-2005

Executing SSIS task from C# application

不想你离开。 提交于 2019-12-23 04:43:40
问题 I can successfully run the SSIS package from my C# App. Is there a way to run a specific task within the SSIS package from .NET (C#) Application? 回答1: We did something like this with an ASP.NET Web Forms application a few years back basically by creating a SQL Agent Job with just one step that executed the SSIS package that had been deployed to the server and then invoking it via the Enterprise Library public bool ExecutePackage(string jobName) { int result = -1; bool success = false; try { /

What is the best way to generate XML from the data in the database?

点点圈 提交于 2019-12-23 04:29:17
问题 If I have thousands of hierarchical records to take from database and generate xml, what will be the best way to do it with a good performance and less CPU utilization? 回答1: You can output XML directly from SQL Server 2005 using FOR XML The results of a query are returned as an XML document. Must be used with one of the three RAW, AUTO and EXPLICIT options RAW Each row in the result set is an XML element with a generic identifier as the element tag AUTO Results returned in a simple nested XML

What is the best way to generate XML from the data in the database?

烂漫一生 提交于 2019-12-23 04:29:14
问题 If I have thousands of hierarchical records to take from database and generate xml, what will be the best way to do it with a good performance and less CPU utilization? 回答1: You can output XML directly from SQL Server 2005 using FOR XML The results of a query are returned as an XML document. Must be used with one of the three RAW, AUTO and EXPLICIT options RAW Each row in the result set is an XML element with a generic identifier as the element tag AUTO Results returned in a simple nested XML

Need to alter column types in production database (SQL Server 2005)

天涯浪子 提交于 2019-12-23 04:20:51
问题 I need help writing a TSQL script to modify two columns' data type. We are changing two columns: uniqueidentifier -> varchar(36) * * * has a primary key constraint xml -> nvarchar(4000) My main concern is production deployment of the script... The table is actively used by a public website that gets thousands of hits per hour. Consequently, we need the script to run quickly, without affecting service on the front end. Also, we need to be able to automatically rollback the transaction if an

Select Count(*) over large amount of data

雨燕双飞 提交于 2019-12-23 03:47:06
问题 I want to do this for a Report but i have 20,000,000 of records in my table and it causes an TimeOut in my application. SELECT T.transactionStatusID, TS.shortName AS TransactionStatusDefShortName, count(*) AS qtyTransactions FROM Transactions T INNER JOIN TransactionTypesCurrencies TTC ON T.id_Ent = TTC.id_Ent AND T.trnTypeCurrencyID = TTC.trnTypeCurrencyID INNER JOIN TransactionStatusDef TS ON T.id_Ent = TS.ent_Ent AND T.transactionStatusID = TS.ID WHERE T.id_Ent = @id_Ent GROUP BY T

Help needed in getting total resource count (SQL Server 2005)

半腔热情 提交于 2019-12-23 03:41:38
问题 I have a requirement. I have been given the following table DownLineid UplineId Name DirectResources 1 2 Sarvesh 7 2 NULL Admin 5 3 2 Lonesh 10 4 2 Swapna 2 5 2 Priyanka 12 8 2 Sumi 1 6 5 Deepak 10 7 5 Agnijita 6 9 5 Me 1 The scenario is UplineId means the Top Managers and the Downlines means the Managers working under the Upliners. My task is to find out the total resources for the Upliners . The desired output is UplineId DownLineid Name DirectResources TotalResources NULL 2 Admin 5 54 2 3

Selecting Time ranges from Date Time fields in Access

懵懂的女人 提交于 2019-12-23 03:18:23
问题 I have a table containing reports and the date/time they were created. I'd like to create a graph to tally the number of reports created during intervals of ten minutes between two time periods: 8:00AM-9:00AM and 1:00PM-2:00PM. Here's an example of a query I'd like to run: SELECT s.StudyStartDateTime AS "8:00 - 8:10", s.StudyStartDateTime AS "8:10 - 8:20", s.StudyStartDateTime AS "8:20 - 8:30", s.StudyStartDateTime AS "8:30 - 8:40", s.StudyStartDateTime AS "8:40 - 8:50", s.StudyStartDateTime

SQL Recursive Menu Sorting

随声附和 提交于 2019-12-23 03:08:12
问题 I've got a simple table that I'm using to represent a hierarchy of categories. CREATE TABLE [dbo].[Categories]( [ID] [int] IDENTITY(1,1) NOT NULL, [Title] [varchar](256) NOT NULL, [ParentID] [int] NOT NULL, CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO INSERT INTO [MDS].[dbo].[Categories]([Title],[ParentID]) VALUES ('All', 0)

What are the ideal tools to analyze sql scripts?

[亡魂溺海] 提交于 2019-12-23 02:57:20
问题 I have a huge ETL script that I am planning to understand. Are there any visual tools that can help me understand it more easily? I am using SQL Server 2005. 回答1: This tool, SQL Enlight, may help you: For example, see the section "Summarize T-SQL script" of this URL. Unfortunately, its not a free product, but they do offer a free trial. 来源: https://stackoverflow.com/questions/1239530/what-are-the-ideal-tools-to-analyze-sql-scripts

database connectivity?

邮差的信 提交于 2019-12-23 02:39:07
问题 How to establish SQL 2005 database connectivity with Java application. Actually I don't know how to set path for JDBC. Any help would be great. 回答1: Download the jdbc driver from http://www.microsoft.com/sqlserver/2005/en/us/java-database-connectivity.aspx. You can either download the Windows or Unix version. It does not really matter which one you use. If you chosed the Windows version, run the downloaded exe file; this will create a directory called Microsoft SQL Server 2005 JDBC Driver in