sql-server-2000

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

☆樱花仙子☆ 提交于 2019-11-27 14:09:29
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. It does it by doing a bit of dynamic SQL with an exec statement (ugly i know but I'm on SQL 2000 so a

Restore a SQL Server 2000 backup on SQL Server 2012

梦想与她 提交于 2019-11-27 13:54:22
I have got following error message while restoring a backup from SQL Server 2000 to the latest version. I do not know the old version, now I am using SQL Server 2012 (11.0.3128.0). The error message is: Msg 3169, Level 16, State 1, Server FF101, Line 1 The database was backed up on a server running version 8.00.0760. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. You are trying to restore a SQL Server 2000 database on SQL Server 2012. This

How to create and populate a table in a single step as part of a CSV import operation?

喜夏-厌秋 提交于 2019-11-27 13:15:21
I am looking for a quick-and-dirty way to import CSV files into SQL Server without having to create the table beforehand and define its columns . Each imported CSV would be imported into its own table. We are not concerned about data-type inferencing. The CSV vary in structure and layout, and all of them have many many columns, yet we are only concerned with a few of them: street addresses and zipcodes. We just want to get the CSV data into the SQL database quickly and extract the relevant columns. I'd like to supply the FieldTerminator and RowTerminator, point it at the CSV, and have the

WHERE IS NULL, IS NOT NULL or NO WHERE clause depending on SQL Server parameter value

人走茶凉 提交于 2019-11-27 12:39:25
I have a stored procedure in SQL Server 2000 that performs a search based on parameter values. For one of the parameters passed in, I need a different WHERE clause depending on its value - the problem is that the 3 values would be where MyColumn IS NULL IS NOT NULL ANY VALUE (NULL AND NOT NULL) (essentially no WHERE clause) I'm having some mental block in coming up with the correct syntax. Is this possible to do in one select statement without performing some IF @parameter BEGIN ... END branching? Patrick McDonald Here is how you can solve this using a single WHERE clause: WHERE (@myParm =

How to monitor SQL Server Agent Job info in C#

此生再无相见时 提交于 2019-11-27 08:57:55
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. i can do this already... i select form table "Sysjobserver" in database "msdb" for read status, date, time of job that i want. use this code public void

EF code first: Cannot insert explicit value for identity column in table '' when IDENTITY_INSERT is set to OFF

允我心安 提交于 2019-11-27 08:39:11
问题 I have issue with EF code first when I am trying to insert new record into table I recieve message. Cannot insert explicit value for identity column in table '' when IDENTITY_INSERT is set to OFF. Any idea why I am getting the error? I am using following code: public void SaveNewResponse() { using (var context = new Context()) { var newResponse = new Response() { lngRequestLineID = 1001233, memXMLResponse = "test Response", fAdhoc = false, }; context.tblResponses.Add(newResponse); context

Perform regex (replace) in an SQL query

半城伤御伤魂 提交于 2019-11-27 08:04:27
What is the best way to replace all '&lt' with < in a given database column? Basically perform s/&lt[^;]/</gi Notes: must work in MS SQL Server 2000 Must be repeatable (and not end up with <;;;;;;;;; ) Some hacking required but we can do this with LIKE , PATINDEX , LEFT AND RIGHT and good old string concatenation. create table test ( id int identity(1, 1) not null, val varchar(25) not null ) insert into test values ('< <- ok, &lt <- nok') while 1 = 1 begin update test set val = left(val, patindex('%&lt[^;]%', val) - 1) + '<' + right(val, len(val) - patindex('%&lt[^;]%', val) - 2) from test

What does the pipe/veritcal bar character mean in TSQL? [duplicate]

谁说我不能喝 提交于 2019-11-27 07:55:55
问题 This question already has an answer here: What does the pipe operator do in SQL? 4 answers Google-fu is failing me on this one. Can anyone briefly explain what the following statement would do?: UPDATE message WITH (ROWLOCK) SET message = message | 2 I found this in a trigger, and I am unable to find docs explaining what the | character does in a statement like this. 回答1: That is a bitwise OR http://msdn.microsoft.com/en-us/library/ms176122.aspx 回答2: It's the bitwise OR operator. See this

SQL Server: ORDER BY in subquery with UNION

拜拜、爱过 提交于 2019-11-27 07:47:02
问题 i have two queries being combined with a UNION ALL 1 : --Query 1 SELECT Flavor, Color FROM Friends --Query 2 SELECT Flavor, (SELECT TOP 1 Color FROM Rainbows WHERE Rainbows.StrangerID = Strangers.StrangerID ORDER BY Wavelength DESC ) AS Color FROM Strangers Both of which, of course, work fine separately, but when combined with a UNION ALL : SELECT Flavor, Color FROM Friends UNION ALL SELECT Flavor, (SELECT TOP 1 Color FROM Rainbows WHERE Rainbows.StrangerID = Strangers.StrangerID ORDER BY

Best way to get identity of inserted row in Linked server?

感情迁移 提交于 2019-11-27 06:41:58
问题 I am inserting record in a remote Sql Server using Linked server, Now I wanna get the id of inserted record. something like scope_identity() in local server. My remote sql server is 2000 version. I have seen this post but I can't add any stored procedures in remote sql server 回答1: You could use the remote side's sp_executesql : DECLARE @ScopeIdentity (ID int); INSERT INTO @ScopeIdentity EXEC server .master..sp_executesql N' INSERT INTO database . schema . table ( columns ) VALUES ( values );