sql-server-2005

How do I remove offline Files from a SQL Server 2005 database

我怕爱的太早我们不能终老 提交于 2019-12-24 02:15:05
问题 I have a database that was restored from a SQL 2000 instance to a SQL 2005 instance some time ago. The SQL 2000 instance had old, unused Full Text Searches defined. It appears that, when the file was restored, the full text searches were not restored but just deleted. This left the database in a funny state, with the FTS files still associated with the database but the files the database knows about listed as OFFLINE. Which, it turns out, keeps the database from having a full backup done. So,

SQL Server 2005 - character encoding issue

筅森魡賤 提交于 2019-12-24 02:10:48
问题 I'm trying to store this value : țșșțșțșțșîăâ./,șllkoăîâ= into a column in SQL Server. The column is nvarchar(1000) and the insert statement looks like N'țșșțșțșțșîăâ./,șllkoăîâ=' But the data inside is still showing up like : ?????????îaâ./,?llkoaîâ= Any ideas on what I could try ? EDIT I just realized that I had changed the datatype in the database , but the linq2sql mapping remained with varchar instead of nvarchar. That's what was causing the issue - I only saw that after trying the

SQL EXCEPT performance

不羁的心 提交于 2019-12-24 02:06:45
问题 I'm trying to use a query similar to the following query to find differences between two tables (the same table in a DEV database vs a TEST database). Each table has ~30K rows and ~5 columns. select field1,field2,field3,field4,field5 from dev.dbo.table1 where field1+field2 in ('string1','string2','string3',...,'string50') except select field1,field2,field3,field4,field5 from test.dbo.table1 where field1+field2 in ('string1','string2','string3',...,'string50') field1 is char(5) and field2 is

In SQL Server 2005, how to get tables in other databases on which view depends?

血红的双手。 提交于 2019-12-24 02:03:20
问题 In SQL Server 2008, for a view in a given database, I can get the tables in other databases on which the view depends by executing: select distinct referenced_database_name, referenced_schema_name, referenced_entity_name from sys.dm_sql_referenced_entities ('dbo.NameOfView', 'OBJECT') where referenced_database_name is not null However, sys.dm_sql_referenced_entities is not available in SQL Server 2005. Is there a way to obtain, from the metadata, a list of tables in other databases on which a

In SQL Server 2005, how to get tables in other databases on which view depends?

自古美人都是妖i 提交于 2019-12-24 02:01:34
问题 In SQL Server 2008, for a view in a given database, I can get the tables in other databases on which the view depends by executing: select distinct referenced_database_name, referenced_schema_name, referenced_entity_name from sys.dm_sql_referenced_entities ('dbo.NameOfView', 'OBJECT') where referenced_database_name is not null However, sys.dm_sql_referenced_entities is not available in SQL Server 2005. Is there a way to obtain, from the metadata, a list of tables in other databases on which a

SQL: Getting the physical size of a subset of a table

六眼飞鱼酱① 提交于 2019-12-24 01:59:07
问题 I'm getting the size of tables in my database using sp_spaceused MyTable Does anyone know a good way of finding out how much space only a certain subset of that data is taking up? So, for example, if I want to find out how much space I would reduce by deleting all records from MyTable that are older than 2 years old. So instead of the space used by MyTable I would get the space used by (SELECT * FROM MyTable WHERE AddedDate < '2010'). Thanks 回答1: Wouldn't it just be more or less exactly the

How to get ID (PK) of newly created record?

余生颓废 提交于 2019-12-24 01:53:33
问题 Given a table: CREATE TABLE [GENERIC_TABLE] ( [RECORD_ID] [int] IDENTITY(1,1) NOT NULL, [SHORT_DESC] [varchar] (50) NULL, CONSTRAINT [PK_GENERIC_TABLE] PRIMARY KEY CLUSTERED ... I want to INSERT a record and get the value of the new RECORD_ID into a ColdFusion variable. What should my CFQUERY look like? (Admittedly, this is probably an overly easy question. In my defense I am used to working with Oracle, not SQL Server.) This for ColdFusion 8, but version-neutral solutions are good. 回答1: If

OdbcCommand on Stored Procedure - “Parameter not supplied” error on Output parameter

那年仲夏 提交于 2019-12-24 01:48:40
问题 I'm trying to execute a stored procedure (against SQL Server 2005 through the ODBC driver) and I recieve the following error: Procedure or Function 'GetNodeID' expects parameter '@ID', which was not supplied. @ID is the OUTPUT parameter for my procedure, there is an input @machine which is specified and is set to null in the stored procedure: ALTER PROCEDURE [dbo].[GetNodeID] @machine nvarchar(32) = null, @ID int OUTPUT AS BEGIN SET NOCOUNT ON; IF EXISTS(SELECT * FROM Nodes WHERE NodeName=

HOw to get CSV value for following scenario

微笑、不失礼 提交于 2019-12-24 01:45:08
问题 Here's my current table data. AccountNumber Product ------------------------------ 00505871 Product1 00505871 Product2 00503297 Product3 00900004 Product4 00505871 Product3 00514884 Product3 00503297 Product2 00505871 Product1 How can I achieve following result. AccountNumber ProductString ------------------------------------------------ 00505871 Product1,Product2,Product3 00503297 Product2,Product3 00900004 Product4 00514884 Product3 Thanks, Ashish Chotalia 回答1: select AccountNumber, stuff(

Stubborn column data type in SSIS flat flat file connection manager won't change. :(

↘锁芯ラ 提交于 2019-12-24 01:43:10
问题 I have inherited an existing SSIS package that imports flat file data into my SQL Server 2005 database. I need to change the data type of the "Gross Sales" column from "numeric" to "currency". When I change the data type and export the package the data type remains numeric. I have also tried creating a new flat file connection to use in the same package, but for some strange reason it still remains numeric instead of "cy" currency. I guess there is something "stuck" in some other area that is