sql-server-2005

SSIS Object Model - Excel Connection Manager Error On 64bit Machine

I have a SSIS package which reads an Excel File (Data Flow Source) and transfer the data to SQL Server using OLEDB Destination Data Flow Item.This package is executed by .Net Application using the SSIS Object model. The package stored in a file system within the application subfolder. The package works fine on my development/test machin...

Create View fails with "Invalid Object Name" where Create Procedure would run with warning- why?

Due to dependencies, if I DROP all my stored procs then CREATE, if a proc is missing when another proc that depends on it is created, the procedure is still created but with a warning along the lines of "cannot add rows to sysdepends... procedure will still be created". That's all fine. However, if we do the same thing with Views, the V...

Giving conditions in SQL SELECT statement

Hi All, I have to run an SQL query based on conditions. There are 2 AND conditions that needs to be executed only if the if conditions for them are satisfied. Can we use CASE statement here. If so how? Or are there any other methods?? SELECT * FROM MyTable WHERE col1=@val1 if condition1 here AND col2 = @val2 end if if condition2 her...

Does bcp out maintain row order while exporting into a data file?

I need to export data to a file from a huge table with only one column but thousands of rows where the ordering of row is important. I am using bcp command as below bcp DBNAME.dbo.tblName out mydata.dat -Uusername -Ppassword -c I checked with the table having 10 rows and I see that the order of the rows is maintained in the data file...

Need some help understanding IO Statistics

I have a query that has a very costly INDEX SEEK operation in the execution plan. In order to track down the cause i set IO STATISTICS on and ran it. In the problem section it gave the following statistics: Table '#TempStudents_Enrollment2_____________________________________000000004D5F'. Scan count 0, logical reads 60, physi...

How do I efficiently group data in a hierarchical format in T-SQL?

I have data like this: Task | Hours 1.1 | 40 2 | 40 2.1 | 60 2.1.1 | 15 15.9 | 24 16 | 5 19.1 | 40 19.1.1 | 8 19.1.2 | 12 19.2 | 6 19.2.1 | 21 19.2.2 | 15 19.2.3 | 2 19.3 | 64 I would like to group based on the first two levels of the Task, producing this result...

Debugging stored procedures in Management studio

Is there a way to step into the Stored procedure code in SQL Management Studio. I know this is possible with Visual Studio, but I am looking for a dependable debugging solution from within Management Studio ...

Attaching a database

I am trying to attach a database in sql 2005 but I get an error msg that the _log.ldf file was not found How do I create the _log.ldf file? TITLE: Microsoft SQL Server Management Studio Attach database failed for Server 'localhost'. (Microsoft.SqlServer.Smo) ADDITIONAL INFORMATION: An exception occurred while executing a Transact-...

How to store different select value to the same variable

Hi, Is it possible to store different select value to the same variable? DECLARE @cout int SELECT @cout= count(*) FROM Master1 WHERE (...) SET @cout = SELECT count(*) FROM Master2 WHERE (...) SET @cout = SELECT count(*) FROM Master3 WHERE (...) IF(@cout = 0) BEGIN END ...

Datatype for storing barcodes in sql server 2005

Hai guys, What datatype you would suggest for storing barcode values in sql server 2005? ...

How to add Default Value for a New Column in SSIS?

I'm using dtsx in data migration between two SQL Server instance. One of the table changed the schema by adding a new text field which is not nullable. How can I add defualt value for the field or map it from another table? Thanks! ...

Please tell me how to get primary key name in SQL Server 2005

I need a primary key name and primary key column name of a table please tell me what query should I write.. ...

Update field from another table

Is there a better way to write the following simple SQL Server 2005 update statement? This just seems a bit messy inefficient. UPDATE QuotationItem SET Recurring_Cost = (SELECT TOP (1) Recurring_Cost FROM Products WHERE (Remote_ID = QuotationItem.Product_ID)) WHERE (Quotation_ID ...

How can import excel 2007 into sql server 2005

I want to import an excel 2007 file .xlsx file to sql server 2005 developer edition. but when I try Task> import data i jus can see options for Excel 2000 to 2005 ...

Better for SQL Query performance to use an actual denormalized table with indexes rather than an indexed view?

In order to improve the performance of a query I have created a denormalized indexed view that contains some of the information I need to report on. When I didn't get the performance gains that I had hoped for I created a table version of my view with indexes and got significantly better performance. I should note that when I create ...

READ_COMMITTED_SNAPSHOT on SQL Server 2005 in 2000 Compatability Mode?

Hello, While investigating a problem I believed to be related to lock escalation and thinking that READ_COMMITTED_SNAPSHOT would be the solution, I checked whether it was already enabled. To my surprise, the database had compatibility level 80 (SQL Server 2000, and I'm new here, and nobody or document seems to know why!). But READ_COM...

Good way to translate numeric to string, with decimal point removed?

Hi everyone, I have to deal with a numeric value (coming from a SQL Server 2005 numeric column) which I need to convert to a string, with the caveat that the decimal point has to be removed. The data itself is accessible in C# via a DataTable/DataRow. For example, if the SQL Server column reads 12345.678, the string should be "1234567...

SSMA upgrade makes forms read-only?

I have a database that I have recently upgraded via SSMA to use SQL Server 2005. If I open a form that is bound to a table, it will display the data from the table; however, I am unable to edit the form and save the information. Simply typing in a textbox does nothing. I have noticed that the Access DB now has extra "tables" that begi...

SQL Server 2005 Transaction Log too big

I am running SQL Server 2005. My db backup scheme is: Recovery model: FULL Backup Type: Full Backup component: Database Backup set will expire: after 0 days Overwrite media: Back up to the existing media set, Append to the existing backup set The db is writing to 250GB drive (232GB actual). My _Data.mdf file is over 55GB and my _Log.l...

SQL Server 2005 No Space for Transaction Log Backup

Possible Duplicate: SQL Server 2005 Transaction Log too big I am running SQL Server 2005. My db backup scheme is: Recovery model: FULL Backup Type: Full Backup component: Database Backup set will expire: after 0 days Overwrite media: Back up to the existing media set, Append to the existing backup set The db is writing to 250G...