sql-server-2000

SQL Server Management Studio: Import quietly ignoring 99.9% of data

The Problem i'm trying to import data into a table using SQL Server Management Studio's Import Data task. It only brings in 26 rows, out of the original 49,325. (Edit: That's where 99.9% comes from: (1-26/49325)*100 = 99.9% Using DTS in Enterprise Manager correctly brings all 49,325 rows. Why is SSMS not importing all rows, reporting ...

Rotate table data with out update data

SELECT * FROM `your_table` LIMIT 0, 10 ->This will display the first 1,2,3,4,5,6,7,8,9,10 SELECT * FROM `your_table` LIMIT 5, 5 ->This will show records 6, 7, 8, 9, 10 I want to Show data 2,3,4,5,6,7,8,9,10,1 and next day 3,4,5,6,7,8,9,10,1,2 day after next day 4,5,6,7,8,9,10,1,2,3 IS IT POSSIBLE with out updating any data o...

Efficient way to alter 100GB table

We have a number of databases which store 10s to 100s of gigabytes of data in one of the tables. It contains image data. The problem is that a lot of these databases were created improperly. Basically the primary key isn't actually a primary key. The were created with a unique index on a nullable column. And some of them have an int...

Searching in multiple tables using MS SQL Server 2000

We have a database with a lot of information about Persons. I won't post the entire database structure because it is too big, but it looks something like this: Person ID Name Street City State Country Language LangCode Language Interest ID LastChangedBy LastChangedOn LocalizedInterest InterestID LangCode Description PersonInterest...

Deadlock caused by SELECT JOIN statement with SQL Server

When executing a SELECT statement with a JOIN of two tables SQL Server seems to lock both tables of the statement individually. For example by a query like this: SELECT ... FROM table1 LEFT JOIN table2 ON table1.id = table2.id WHERE ... I found out that the order of the locks depends on the WHERE condition. The que...

Run SQL Server 2000 Job programmatically

I know you can execute a Job in SQL Server 2005/2008 by sending a call to the Stored Procedure msdb.dbo.sp_start_job. However is it possible to do this programmatically for SQL Server 2000? I am using VB.NET however I believe the language I'm using is irrelevant on how to go about it. If someone knows how to do it in VB.NET (or C#, I ...

Parse a string before the Last Index Of a character in SQL Server

I started with this but is it the best way to perform the task? select reverse( substring(reverse(some_field), charindex('-', reverse(some_field)) + 1, len(some_field) - charindex('-', reverse(some_field)))) from SomeTable How does SQL Server treat the multiple calls to reverse(some_field)? Besides a ...

SQL Server Enterprise Manager - Mass Delete of Tables and Changing Ownership of Tables

I have pretty much no experience with SQL Server's Enterprise Manager so I am not sure if this is even possible (or hopefully laughably simple!) During an import into a database something has happened where each table has duplicated itself with two important differences. The first is that the Owner on both tables is different, the seco...

How to monitor SQL Server Agent Job info in C#

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 suggestio...

How can I query 'between' numeric data on a not numeric field?

I've got a query that I've just found in the database that is failing causing a report to fall over. The basic gist of the query: Select * From table Where IsNull(myField, '') <> '' And IsNumeric(myField) = 1 And Convert(int, myField) Between @StartRange And @EndRange Now, myField doesn't contain numeric data in all the rows [it is o...

connection string with no user name and password, asp.net

i have a website built in asp.net connecting to a sql 2000 db. within my web.config file, i have a connection string referencing a DSN. in order for my db connection to work i have to include the username and password within the string. for security reasons, is there any way to connect to my db without displaying the username and passwo...

Call sp within another sp

I have an sp named 'FolderSttructure'.It returns the following result - FolderID 1 2 3 4 I have to call the above sp 'FolderSttructure' inside another sp named 'SearchFolder' and insert the result of first sp in to a temperory table. Is it possible? If yes how can we do that? ...

Export to excel from SQL Server 2000 using Query Analyzer code

What's the easiest way to export data to excel from SQL Server 2000. I want to do this from commands I can type into query analyzer. I want the column names to appear in row 1. ...

Return all values from IN Clause on SQL Server 2000

Is there a way to retrieve all the data from an IN clause? Let's assume my table got (ID,Name): 0 Banana 1 Mango 2 Papaya 3 Lemon and my query: SELECT * FROM Fruits WHERE Name IN (Banana,Mango,Orange) I Want 'Orange' to return, with an empty ID (since there's no register). How to do this? ...

Converting a Text Datatype field into a DateTime.

I'm using SQL Server 2000 and my ERP vendor has used a Text datatype field to hold Dates. The Dates look like: 6/21/2001 However, some of them are blank. I've tried using something like: select coalesce(nullif(fdelivery, ''), '1/1/1900') FROM sorels to remove the blanks to no avail. I've also tried: case when ltri...

how to check which tables and fields take more space?

I have one database that has a bigger size than expected, how can I query it to retrieve the fields that take more space. let's say I have 2 only tables Table1.FieldOne Table1.FieldTwo Table2.FieldOne Table2.FieldTwo Let's say 99.9% of DB data is in Table2.FieldTwo, how do I query the db? Of course I have many many tables. The db i...

SQL Server 2000 connection string converted to SQL Server 2008

I have a SQL Server 2000 connection string that I need to work with SQL Server 2008. I am using a DSN and it works just fine, but when I try to connect from the web page, the page never loads and I have to restart my IIS to get the web page to load again. this is my SQL Server 2000 string: MM_RFI_Datasource_STRING = "DSN=RFI_Datasour...

ADOQuery is bypassing instead of delete trigger

I´m using Delphi 5 with SQL Server 2000 here. I have created an ADOQuery on top of an updatable view with an INSTEAD OF DELETE trigger. The updatable view is basically used for controlling soft deletes. It filters out records which are marked as deleted and it hides the controlling column as well. It all works fine when I´m issuing di...

Reading the contents of a SQL Server job in VB.NET

I am writing an application that will call a SQL Server job on all our client's systems. I'm able to execute it, and wait until it's finished. It has an output file that's save location is hard coded into the job however, and this is not the same location on all client's. Since the job is identical on systems minus this one value, I wa...

How to find when a table was last accessed/updated for SQL Server 2000 sp4

I need to find if a certain table has had any activity(update/query). Is there are way to find this information in SQL Server 2000 (sp4 to be specific) There is a helpful query using sys.dm_db_index_usage_stats, but it is supported only post SQL Server 2005. I am looking for something similar on SQL Server 2000. Thank You for your time...