sql-server-2000

Most efficient method to detect column change in MS SQL Server

筅森魡賤 提交于 2019-12-17 15:37:52
问题 Our system runs on SQL Server 2000, and we are in the process of preparing for an upgrade to SQL Server 2008. We have a lot of trigger code where we need to detect a change in a given column and then operate on that column if it has changed. Obviously SQL Server provides the UPDATE() and COLUMNS_UPDATED() functions, but these functions only tell you which columns have been implicated in the SQL statement, not which columns have actually changed. To determine which columns have changed, you

How do i represent an unknown number of columns in SSRS?

你。 提交于 2019-12-17 11:15:12
问题 I'm working on a rather complex report in Sql Server Reporting Services. My SP returns a dynamic number of columns each of which are dynamically named. Basically think of a time keeping application. Each column that is dynamic represents a time bucket that time was charged to for that team. If no time was charged to that bucket for the period of time the report covers it doesn't show. Each bucket has its own identifier which i need to be the column headers. I have an SP that returns this all.

How do i represent an unknown number of columns in SSRS?

纵饮孤独 提交于 2019-12-17 11:15:11
问题 I'm working on a rather complex report in Sql Server Reporting Services. My SP returns a dynamic number of columns each of which are dynamically named. Basically think of a time keeping application. Each column that is dynamic represents a time bucket that time was charged to for that team. If no time was charged to that bucket for the period of time the report covers it doesn't show. Each bucket has its own identifier which i need to be the column headers. I have an SP that returns this all.

How to monitor SQL Server Agent Job info in C#

偶尔善良 提交于 2019-12-17 09:50:02
问题 I need to create an application for monitoring SQL Server 2000 Agent Job status and info when Job occur same as show on Windows application event log. Now I connect to the database already via a connection string, but I don't know how to get the status and info from Job. I need to show status and info on Textbox. What do you suggestion how to do. Developer tools : MS SQL Sever 2000 SP4 MS Visual Studio 2008 (C#) I am a rookie programmer. 回答1: i can do this already... i select form table

INSERT INTO @TABLE EXEC @query with SQL Server 2000

孤街浪徒 提交于 2019-12-17 06:33:55
问题 Is it true that SQL Server 2000, you can not insert into a table variable using exec? I tried this script and got an error message EXECUTE cannot be used as a source when inserting into a table variable. declare @tmp TABLE (code varchar(50), mount money) DECLARE @q nvarchar(4000) SET @q = 'SELECT coa_code, amount FROM T_Ledger_detail' INSERT INTO @tmp (code, mount) EXEC sp_executesql (@q) SELECT * from @tmp If that true, what should I do? 回答1: N.B. - this question and answer relate to the

Stored Procedure Confusion

我是研究僧i 提交于 2019-12-14 03:58:45
问题 I am trying to create a stored procedure which will check for a list names in a table and there corresponding (boolean/bit) values, even if one of record has value as true, stored procedure should return True, if not then return false. Here's the table, Table Name - FruitCrate Column A (VarChar (Max)) - FruitName Column B (bit) - Eatable Now I want a stored procedure whom I can provide a List FruitNames and it checks if any of them is eatable then return true otherwise false. Not sure how to

SQL Server 2000: Invalid operator for data type. Operator equals add, type equals ntext

六月ゝ 毕业季﹏ 提交于 2019-12-14 03:28:21
问题 I have a stored procedure which gets Ntext parameters. Inside the stored procedure, I have a varchar variable and I set this varchar variable by concatenating few strings. I get the following error at this point, while compiling. Invalid operator for data type. Operator equals add, type equals ntext. Can someone help? 回答1: I made a careless Mistake. I was actually concatenation my varchar variable with the ntext variable. As Ntext concatenation is not allowed, I got stuck. 来源: https:/

Logic in stored procedure

元气小坏坏 提交于 2019-12-14 03:03:40
问题 I have need of some logic in a stored procedure. All the stored procedure does it perform a couple of logic rules and then returns a true or false depending on the result. The pseudo SQL code: CREATE TABLE #PV ([Date] DATETIME, Dis FLOAT, Del Float, Sold Float) INSERT #PV exec GetPVSummaryReport @ID, @PID, @From, @To SELECT AVG(Dis) / 8 AS DisAvg, AVG(Del) AS DelAvg FROM #PV IF DisAvg > 20 -- this is the bit I am having problems grokking RETURN TRUE ELSE -- do longer calculation How do you do

“Select in” with “ordered pairs”

久未见 提交于 2019-12-13 19:02:44
问题 I have a table structure like this. ProductCR productID ProductName 09 1553 A1 09 1600 A2 09 1800 A3 10 1553 A4 10 1600 A5 10 2000 A6 I want to make something like this: Select ProductoName from Products where (ProductCR,ProductID) in ((09,1553),(10,1600),(10,2000)) Result: A1 A5 A6 Is this posible in Sql Server?? such a "select in" with "ordered pairs"?? Thanks, Victor. 回答1: It is not possible. I this this is a good option: DECLARE @orderedPairs TABLE (cr int, id int) INSERT INTO

Date Table/Dimension Querying and Indexes

青春壹個敷衍的年華 提交于 2019-12-13 18:19:12
问题 I'm creating a robust date table want to know the best way to link to it. The Primary Key Clustered Index will be on the smart date integer key (per Kimball spec) with a name of DateID. Until now I have been running queries against it like so: select Foo.orderdate -- a bunch of fields from Foo ,DTE.FiscalYearName ,DTE.FiscalPeriod ,DTE.FiscalYearPeriod ,DTE.FiscalYearWeekName ,DTE.FiscalWeekName FROM SomeTable Foo INNER JOIN DateDatabase.dbo.MyDateTable DTE ON DTE.date = CAST(FLOOR(CAST(Foo