sql-server-2005

SQL Server 2005 SSIS job that writes a file to another server will not run, but will run through MSDB

I have a SSIS package that writes to a csv file on another server. It will run fine when I execute it manually out of the MSDB folder, but when I try to run it through a job, it fails with the following errors: If I run it with the file path as W:\share\file.csv (I have the other server mapped to the drive letter W:), I get: Execute...

SQL query look for exact match using inner join

Hi! I have 2 tables in SQL Server 2005 db with structures represented as such: CAR: CarID bigint, CarField bigint, CarFieldValue varchar(50); TEMP: CarField bigint, CarFieldValue varchar(50); Now the TEMP table is actually a table variable containing data collected through a search facility. Based on the data conta...

SSIS Import excel sheet error

Hi I am tring to import data from excel to sql 2005 .working fine in VS2005,but not working while running from cmd using dtexec. error description as follows "Microsoft JET Database Engine" Hresult : 0x80004005 Description: "The Microsoft Jet database engine could not find the object . Can anyone help how to resolve this issue ...

How can I handle multiple row revisions in a single table?

I'm working on an app where users enter pricing quotes. They want to be able to have multiple revisions of the quotes and have access to all of them to revise and view. Currently the data is stored in a Quotes table that looks like this: QuoteID (PK, autonumber) data1, data2, data3 and so on. QuoteID foreign keys to other tables for o...

How to retreive data stored in a webserver DB using windows application in local machine

My local machine is using windows application for an appointment fixing .I want to retreive data from webserver DB which also does appointment fixing by online for the same organisation.So I want both these to work in co-ordination.As my first step I want to import data.Can anyone help me to solve this issue,Thanks. ...

SQL query to display db data

I have the following database table: Answer MemberID | QuestionNo | AnswerNo | AnswerString 10 | 1 | 2 | q1 anwer2 10 | 2.1 | 3 | q2.1 answer3 10 | 2.2 | 5 | q2.2 answer5 10 | 7 | 1 | q7 answer 7 11 | 1 | 3 | q1 a...

Having trouble with SQL COUNT

I'm using MS SQL 2008 and I have a table of statuses (id, name) and a table of items (id, name, statusid, deleted). I want to count the number of items with each status, and have the following query: SELECT status.id, ISNULL(COUNT (items.name), 0) AS 'count' FROM status LEFT OUTER JOIN items ON items.statusid = status.id GROUP BY statu...

Writing the results of a FOR XML query to a file with C#.NET

Hello, I'm trying to write the result of a FOR XML PATH query to a file. I can generate the file, but it doesn't contain the results of the query. Any one know where i'm going wrong? private static void GetChartData(string OC_Ttl1, string OC_Ttl2, string OC_OL31) { //Prepare Connection Variables SqlConnection conn_...

How to get the start time of an SQL process?

A job running on our SQL server failed. We are running MS SQL server 2005. While investigating, the following question came up: When was this process initiated on the server? Is there any query I can run that will give me this information? ...

PHP - SQL Server 2005 express to 2008 standard problem

I have a PHP app running happily on the following system: web app: PHP version 5.2.3 OS: Windows Server 2003 Standard 32 bit database: SQL Server 2005 (express) web server: IIS 6 I'm trying to get the same thing running on the following: web app: PHP version 5.2.11 OS: Windows Server 2008 Standard 64 bit database: SQL Server 2008...

SQL Server 2005 - Row_Number()

Hi All, I'm trying to understand the unusual behaviour seen when ordering results in a descending order using the row_number() function when using a DISITINCT on the outermost select in my query as below: SELECT DISTINCT (ID), State_Id, Name_Of_Trip, Date_Of_Travel, Creation_Date, Locking_Id, Applicant_Name, Reference_Number, Stat...

MS SQL Server optimizer and varying table and field aliases

We have a lot of quieries for which we append a random alias at the end of field and table names (due to a custom ORM implementation that might be hard to change). The queries are like the following (though substantially more complex, most of the time): SELECT fooA.field1 as field1B, fooA.field2 as field1C FROM foo as fooA ...

If a Column is a Foreign Key does it need an Index?

I have created indexes on many of my columns in my tables. Many of these columns are foreign keys as well. Can I safely delete the indexes on the columns that are foreign keys? ...

How can I retrieve an image from SQL Server using ASP.NET MVC with the EF?

I have seen other questions about this, but I have not seen a complete solution for this. I am using ASP.NET MVC with the Entity Framework, and I have a SQL Server database using an image datatype. View: <% foreach (var v in (IEnumerable<MyNamespace.Models.MyObject>)ViewData.Model) { %> <span> <%= v.Name %> </span> ...

sql server express - date format

Hi, In a sql server 2005 table I have a date column in dd/mm/yyyy format. But everything on sql server 2008 is yyyy-mm-dd. Where abouts can I change the format the dates that are being stored in 2008 to that of 2005? Thanks, ...

How to pivot in SQL

I am not sure if this would be called pivoting. Data in my SQL 2005 table [CustromerRoles] is as such: CustId RoleId 2 4 2 3 3 4 4 1 4 2 [Roles] table: RoleId Role 1 Admin 2 Manager 3 Support 4 Assistant I want to create a view such that: SELECT * FROM [MYVIEW] will...

Why am I getting 'Error converting data type varchar to numeric' on a floating point number in Perl?

We are inserting values into a SQL Server 2005 database column of type NUMERIC(19,5) from Perl. As long as the absolute values are .0001 or greater, it is working. However, when the values go to the 5th decimal place, Perl starts storing them in exponential format (-9e-05 instead of -0.00009), and then we get the error "Error converting ...

How would you build one Select stored procedure to handle any request from a table?

I want to build a single select stored procedure for SQL 2005 that is universal for any select query on that table. **Columns** LocationServiceID LocationID LocationServiceTypeID ServiceName ServiceCode FlagActive For this table I may need to select by LocationServiceID, or LocationID, or LocationServiceTypeID or ServiceName or a com...

How can I programmatically enumerate SQL Server 2005 named instances?

I want to programmatically enumerate the SQL Server 2005 named instances on a server. I know I should be able to do this fairly easily, but I can't for the life of me figure out how. Thanks in advance for any help! ...

What are the Costs of Running a Busy site like Stackoverflow with SQL Server

My site is small now but it is steadily getting popular online. It is running SQL Server express and entity framework. I am not storing any pictures in the database, the database is storing just text. What kind of costs would I be looking at if my site gets big enough where I need to upgrade my database to a paid version and run the data...