sql-server-2000

SQL server table population source

懵懂的女人 提交于 2019-12-11 12:29:59
问题 I have an Audit database(created by someone else). Something is polulating it, with table sizes data (which makes sense as it is Audit database). The SQL server has too many jobs. I want to know what is populating the audit tables. Is there anything like sys.comments etc? which can tell me what is populating tables or do I have to check the code inside each job? Regards Manjot 回答1: Try looking at msdb..sysjobsteps in the command column for the destination table names; this will only work if

SQL server timeout 2000 from C# .NET

我是研究僧i 提交于 2019-12-11 11:41:30
问题 I have run into a strange problem using SQL Server 2000 and two linked server. For two years now our solution has run without a hitch, but suddenly yesterday a query synchronizing data from one of the databases to the other started timing out. I connect to a server in the production network, which is linked to a server containing orders I need data from. The query contains a few joins, but basically this summarizes what is done: INSERT INTO ProductionDataCache (column1, column2, ...) SELECT

Send dbMail from SQL Server 2000 with Tabular structured data?

房东的猫 提交于 2019-12-11 11:29:22
问题 I am trying to achieve this kind of formatted data from my select statement and have it send via database mail in SQL SERVER 2000. I know how to do this in SQL 2008. Column1 | Column 2 ------------------ Value 1 | Value 2 Value 1 | Value 2 Value 1 | Value 2 回答1: I have realized that this can not be done. To achieve this I created .bat file and stored procedures and sendmail utility. First call this in your .bat file osql -S %ServerName% -d %dbname% -U %username% -P %password% -Q "EXEC " -o

How to show the table values in day wise

白昼怎懂夜的黑 提交于 2019-12-11 10:59:17
问题 Table1 ID period fromdate todate Value 001 01/2012 02/01/2012 10/01/2012 AB 002 01/2012 05/01/2012 18/01/2012 AL .... From the above table, i want to show the day wise output. ID, Period should create from the table1, then remaining days column should generate from the period.. Date column should create as per the period, For example 01/2012 means - 31 days column 02/2012 means - 29 days column 04/2012 means - 30 days column I want to show the value days wise from table1 Expected Output id

Query shows 1 less than what's available in the #temp table

半城伤御伤魂 提交于 2019-12-11 10:14:57
问题 So let's say #temp has 4 rows, the output will be 3(should be 4), if it has 1, then output will be 0. I'm not quite sure what's going on. Wondering if anyone can tell by looking at the query. SELECT TH.TnnNumber, CASE WHEN COUNT(DISTINCT TL.DiscountCodeID) > 1 THEN 'Varies, View Tnn' ELSE CAST(MAX(DC.Value) AS NVARCHAR(50)) END AS Discount, CASE WHEN TS.SpinID > 4 THEN 'Has Specifics, View Tnn' ELSE TS.Value END AS Spin, CASE WHEN COUNT(DISTINCT TL.Commission_HMM) > 1 THEN 'Varies, View Tnn'

How can I create a query constraint

冷暖自知 提交于 2019-12-11 08:42:27
问题 I have a table Items, which has fields Inventory and ItemId (the primary key). And I have another table Allocations, which has fields Allocation and ItemId, which is a foreign key referencing Items.ItemId. Thus many Allocations can relate to one Item. I wonder how I can add a constraint to not allow SUM(Allocation) in the Allocations table for the same ItemId to accede Items.Inventory for that ItemId. I could find only very simple examples, so I am not sure how to approach this problem. 回答1:

Join Clause With a XOR Statement

天涯浪子 提交于 2019-12-11 08:28:26
问题 I am doing a join and I can't seem to make this XOR to properly work. SELECT t1.COMPANY, t1.MILES, CASE WHEN t2.MILES IS NULL THEN t3.MILES ELSE t2.MILES END AS MILES2, CASE WHEN t2.MILES = t1.MILES AND t2.MILES != 9999 THEN t2.FLATRATE ELSE t3.RATEBASIS END AS RATE FROM TABLE1 AS t1 LEFT JOIN TABLE2 AS t2 ON t1.[COMPANY] = t2.[COMPANYCODE] AND (t1.[MILES] = t2.[MILES]) INNER JOIN ( SELECT TOP 1 TRUCKERCODE, MILES, RATEBASIS, FLATRATE FROM TABLE2 WHERE MILES = 9999 ) AS t3 ON t1.[COMPANY] =

SQL Running Subtraction

早过忘川 提交于 2019-12-11 08:05:46
问题 Just a brief of business scenario is table has been created for a good receipt. So here we have good expected line with PurchaseOrder(PO) in first few line. And then we receive each expected line physically and that time these quantity may be different, due to business case like quantity may damage and short quantity like that. So we maintain a status for that eg: OK, Damage, also we have to calculate short quantity based on total of expected quantity of each item and total of received line.

SQL Agent Jobs, how to document

送分小仙女□ 提交于 2019-12-11 08:04:44
问题 I want to end up with a sort of Calendar that shows the different scheduled jobs and their steps (the exact command executed). But I"m having a hard time finding all the data. So my question is two-fold: 1) Does anyone know of a software (preferably open source or free) that can get this data from sql server 2000 in a spreadsheet or other easy to manipulate format? 2) Can anyone help me with the queries I'd need to get this data. How are SQL Agent Jobs organized in the database? Any guidance

In SQL Server 2000 how do you add {n} number of 0's to a nchar(n)?

↘锁芯ラ 提交于 2019-12-11 07:49:24
问题 I'm using SQL Server 2000 and I'm not sure if there is already a function to add any number of 0's to an nchar(n) , or if this is best done in a function? Does this look correct proc repeatingCh @n int, -- i/p n to some number of characters @ch nchar(1), --i/p character @ch_n nchar(n) out as begin declare @ch_n as nchar(n) set @ch_n = '' for(i=1 to n) begin @ch_n = @ch_n + @ch end return 1 end I want to call it in a sproc or... most likely a function and return the repeating characters. 回答1: