sql-server

Duplicate Schema

I am creating and maintaining my SQL Server 2008 warehouse database using a Visual Studio 2008 project. When I try to deploy the project, I get an error as below Creating DataWarehouseReports... Company.HigherEducation.DataWarehouse.dbschema(0,0)Error TSD01268: .Net SqlClient Data Provider: Msg 2714, Level 16, State 6, Line 2 There is ...

error when running sql job that has ssis package

Hi, I have a ssis package created in sql server 2005. I am trying to run this in sql server 2008. when I run the command "exec xp_cmdshell 'dtexec /f "C:\MyPackage.dtsx"'" I get the following error. There was an exception while loading Script Task from XML: System.IO.IOException: There is not enough space on the disk. I have a script...

SQL server ignore case in a where expression

How do I construct a SQL query (MS SQL Server) where the "where" clause is case-insensitive? SELECT * FROM myTable WHERE myField = 'sOmeVal' I want the results to come back ignoring the case ...

Use SQL 2008 SSRS and SSAS on a SQL 2000 Instance and Database?

The ERP system that I use is "stuck" in SQL 2000. The vendor states that it will not work, even in 2000 compatibility mode with any version of SQL higher than 2005. Due to corporate red tape I cannot use SQL 2005. Can I install 2008 on the same server as a separate instance and then use the tools of 2008 to create SSRS and SSAS proje...

WITH Common Table Expression vs. CREATE VIEW performance

I have several queries which use a WITH clause, or Common Table Expression, with a UNION ALL statement to recur through a table with a tree like structure in SQL server as described here. Would I see a difference in performance if I were to CREATE that same VIEW instead of including it with the WITH clause and having it generated every ...

How can I only execute an update command if a condition is true?

I'm working on a DB upgrade script that needs to drop a column (that part's easy). Before I can drop the column, I want to take the value and move it into another column that already exists. I'm trying to acheive idempotence with my script, which is where I seem to be failing. I have code like this... IF EXISTS (SELECT * FROM...

sql 2000 + vs 2008, debugging through sproc?

Hey all. Is it possible to step through a sproc on sql server 2000 server using vs 2008? When I go through the server explorer and choose to step into the sproc, it asks me to enter the param values and then it gives me the output of the sproc, without stepping into it. ...

Conditional statement in WHERE clause

I need to write a conditional statement in my where clause that uses different operators based on the parameter passed into the procedure. I can't seem to find the syntax that will work. My example is as follows: @DateValue datetime select * from table where field1 = 'x' and field2 = 'y' and if @DateValue = '1/1/1900' then field...

Add connection dialog closing when fetching list of SQL servers.

I have jus installed VS 2008 on a new machine and when I open up the Add connection dialog box to conect to the SQLExpress server on my machine the diolog box just closes. It's fine until you try and populate the list of running servers then just closes, with no error message :( Has anyone else come across this problem before? ...

Cannot retrieve user object from foreign key relationships using Linq to Entities statement

Hi, I'm trying to retrieve a user object from a foreign key reference but each time I try to do so nothing gets returned... My table is set up like this: FBUserID long, UserID uniqueidentifier so I have my repository try to get the User when it's provided the FBUserID: public User getUserByFBuid(long uid) { User...

How to select an object through a foreign key

If I have a table with a primary key (AccLinkID) and a foreign key (aspnet_Users UserID), how can I select the object that the foreign key points to using Linq to Entities. User myUser = _myDB.AccLinkSet.Where(user => user.LinkID == linkId).FirstOrDefault().aspnet_Users; did not work... anyone have any ideas? ...

SQL server : disk in raid or split DB and OS on different disk ?

Hello, We are going to change our server with a new one with 2 scsi hard disk. My colleague proposed to install the OS windows 2003 on one disk and put the Databases with sql server 2008 (3 of 100 MB and 1 of 2 GB) on the other one. I was thinking that it would be much more performant to use Raid 0 but i don't have enough knowledge to...

Using SQL Server Express 2008 with SQL Server 2005 database -how to check for compatibility

I am using SQL Server 2008 express edition but I want to make my databases still in 2005. How can I set it up to only show features that a 2005 database can use? Like for instance I don't remember there being a "date" type. I only remember "dateTime". I don't want to be using features that 2005 can't support and I later on upload my db...

Delphi 3 to SQL 2008

One my clients has a system written in Delphi 3 and the database is Paradox. My job is to convert it to use SQL Server 2008. How can I make it connect to SQL 2008? This is pretty old stuff, I know. I appreciate the help. Thanks ...

Roll back a transaction

Hi Friends, I am updating some data in a table using transaction. The log of the transactions are available in the ldf files of the database. Now by mistake a user has committed a transaction of deleting records and it got committed and the data got deleted. so is there any way of rolling back that particular transaction. Please, sugges...

select query by range

Hi I want to select values from tables by passing two parameters like start and end ranges How can i get it? Ex: sid sname s001 name1 s002 name2 s003 name3 s004 name4 s005 name5 s006 name6 s007 name7 s008 name8 s009 name9 s0010 name10 here i want to pass two values like 3 and 5 so that my quer...

sql server 2008: bcp_sendrow, issue: invalid time format

Hi! I'm having a problem "Invalid time format" when I try to use bcp functions(bcp_sendrow/bind etc.) to insert into a table having a datetime column. so as per googled examples, I populated a DBDATETIME structure, for example: if I wanted to populate 3rd august 2009, exactly 8am localtime, I'd populate the structure members like so: d...

Get substring in sql server

Hi Guys, I want to get substring in sql server from right split on dot('.'). I have a column which have file name hello.exe , i want to find extension of file exactly as in C# Path.GetExtension("filename") does. Thanks Rajesh ...

System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow

I am working with C#.net and also SQL Server 2008. I have the following error, when trying to run a test unit within my project. System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.. Database Table Column Name: createddate Type: datetime Default Va...

Problem with Entity Framework after adding column to DB table

I needed to add a new NVARCHAR column to a table in my DB. So I added the column, and then fired up Visual Studio to update the EDMX-file for the Entity Framework. I ran update model from database on everything, which only resulted in "data reader is incompatible"-errors. So I renamed the whole table in the DB, updated EDMX from databas...