sql-server-2000

Create foreign key without checking existing data

℡╲_俬逩灬. 提交于 2019-12-13 16:22:31
问题 This is a 2 part question. Question 1: I am trying to create a foreign key on a table where I need to turn off the "Check Existing Data on Creation or Re-Enabling". I know theres an option visually but I'm looking for a way to do it programmatically. Is there anyway to do this? Question 2: I have a code table and two tables A and B that need to reference that code table. I want to have these both referenced from a relationship table but I want to able to use the same column. Can I have 2

Upgrading from SQL 2000 - 2008 - Log Shipping

早过忘川 提交于 2019-12-13 15:56:43
问题 I'm in the process of upgrading from SQL 2000 - SQL 2008 Would it be possible (or feasable) to set up log shipping from Server A - that has the sql 2000 database on, to Server B - that has the SQL 2008 instance on Or is there a better way of upgrading? I need to obviously test my application using the new SQL 2008 instance.... 回答1: You can certainly configure and script the steps that would be required manually, as Log Shipping is simply a copy of your transaction log file taken from the

SQL Server 2K - Insert explicit value for timestamp column?

 ̄綄美尐妖づ 提交于 2019-12-13 13:28:06
问题 I'm curently working on a project where I need to transfer data (with some minor transformations) from one database to another. Everything was going just fine when I hit my first Timestamp column... It seems SQL Server doesn't want me to use explicit values for this type of column and it, instead, wants to generate its own. If there a way, using T-SQL, I can get this data from one table to another? 回答1: Note: The name timestamp is deprecated, the new (and more accurate) name is rowversion.

Image save in database

那年仲夏 提交于 2019-12-13 10:44:44
问题 I want to save an uploaded image to database. Now my question is: What should be the data type for SQL Server 2000 for image? a. image b. varbinary what is the code for saving image in database? How to retrieve the image from database and show? Please refer me any tutorial or guidline. Or if you can please share with me. Thanks in advance. 回答1: The data type should be text because the best way to save an image to a database is to save its path. Let your OS do the job of storing the actual

Query in SQL2000

杀马特。学长 韩版系。学妹 提交于 2019-12-13 08:53:47
问题 How to alter the datatype of a column in a table? 回答1: CREATE TABLE dbo.MyTable (column_a INT ); GO INSERT INTO dbo.MyTable (column_a) VALUES (10); GO ALTER TABLE dbo.MyTable ALTER COLUMN column_a DECIMAL (5, 2); GO DROP TABLE dbo.MyTable; GO 回答2: alter table yourtable alter column yourcolumnname yourdatatype; This only works if SQL can cast the old values to the new values with the new datatype. If this fails, you will have to create a new column, migrate the data some way, and drop the old

Dynamic Pivot for multiple columns in SQL Server 2000

大憨熊 提交于 2019-12-13 08:29:40
问题 I know, it is bad etiquette to post the same question link in other forum, but here it is my question link : http://www.sqlservercentral.com/Forums/Topic1474579-8-1.aspx Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2) Table structure and sample insert statements : create table consumption ( code varchar(6), prodname varchar(50), department varchar(20), netqty

Exclude a specific range of time in a stored procedure

旧城冷巷雨未停 提交于 2019-12-13 07:26:23
问题 I have a stored procedure that queries my database to pull a "Open" report for "Yesterdays" date. This program will run on windows scheduler always querying the database for yesterdays results. I want all of the results from yesterday EXCEPT 5:30AM - 6:26AM. I do not care to see these results... Everything works, with the exception of not displaying the specified time block... My stored procedure is: ALTER PROCEDURE [dbo].[Open_Close] AS declare @dtNow datetime , @dtToday datetime , @dtFrom

SQL Server 2000 Enterprise Manager - Store nvarchar data greater than 4000 characters?

孤者浪人 提交于 2019-12-13 05:07:08
问题 I'm using SQL Server 2000 Enterprise Manager. I'm having trouble with storing some data in a column. The column has a data type of nvarchar, with a length of 4000, which I've now learned is the max length you can have. I need to store data in the column that is longer than 4000 characters...is there a way to increase the size? Or is there another way to store it? 回答1: in SQL Server 2000, the only 2 ways to increase it would be: Use the data type VARCHAR instead of NVARCHAR (VARCHAR's limit is

Classic ASP - display records from databse in the table Week-wise or month-wise

冷暖自知 提交于 2019-12-13 04:29:49
问题 I'm using asp code i.e classic ASP and SQL server 2000 in this process to display records from database into a table. I have two links called week-wise and month-wise . when the user clicks on this link he will see the data week-wise or month-wise assuming the database have a date field which stores all the dates, when the record is inserted. So far i'm able to display records present in the table for that particular user. How can i display his/her records WEEK or MONTH wise. this is the

Compare with Dates and ID?

别来无恙 提交于 2019-12-13 03:50:53
问题 Using SQL Server 2000 I want to get Table2.TimeIn Table2.TimeOut according to Table1.personid and also If Table1.Date = Table3.Date then it should take a Table3.TimeIn, Table3.TimeOut. 3 Tables Table1 ID Date 001 20090503 001 20090504 001 20090506 002 20090505 002 20090506 So on…, Table2 ID TimeIn TimeOut 001 08:00:00 18:00:00 002 08:00:00 21:00:00 So on…, Table3 ID Date TimeIn TimeOut 001 20090504 10:00:00 22:00:00 001 20090505 17:00:00 23:00:00 002 20090505 12:00:00 21:00:00 So on…, Select