sql-server

Database engine independent analog of SqlBulkCopy

What is the best database engine independent way to load a huge amount of data. While I'm using SQL Server I use SqlBulkCopy but want to untie from SQL Server ...

managing Sql Server databases version control in large teams

For the last few years I was the only developer that handled the databases we created for our web projects. That meant that I got full control of version management. I can't keep up with doing all the database work anymore and I want to bring some other developers into the cycle. We use Tortoise SVN and store all repositories on a dedic...

Does SQL Server have an equivalent to Oracle's PL/SQL Package?

I was wondering if SQL Server has an equivalent to Oracle PL/SQL Package? It is really nice to build your sprocs, functions, etc into a Package. ...

ORM - Does the Database Schema Drive the Entity Composition or Vice-Versa?

We've had quite a bit of discussion among our development group concerning whether the composition of entities should drive the database design, or should the database design drive the composition of the entities. For those who have dealt with this, what has been your philosophy? Of course, not every entity maps 1:1 to a database table....

how to get top n rows from a table where value of n is passed at run-time?

how to get top n rows from a table where value of n is passed at run-time? Thanks in advance ...

Search query, 'order by' priority

I need implement simple search in small content table: id, name, description, content. Results must be order by priorities name description content it's mean that if searched word was found in description field, it will be shown only after all rows that have dog in name field What I did: I tried create temp table with structure lik...

SQL: Mark which WHERE condition matched

This is a theoretical question, I was wondering if there is a good way of finding out which condition in the WHERE statements matched. Say I have a query like this: SELECT * FROM table WHERE COND1 OR (COND2 AND COND3) OR COND4 Is there any way of knowing which of the conditions made a given row match (or unmatch)? One ...

TSQL procedure which would perform multiple selects and join them into one result

I need to write a TSQL procedure which would perform 4 selects and join results int one dataset. Can this be done? P.S. Selects are performed in a loop EDIT Here is the schema. I wan't to get N latest points from each Unit which belongs to SOME map. Maps Id Maps2Units MapId UnitId Units Id Points Id UnitId T...

SubSonic 3.0 Multiple Where clause with inner joined tables

Hi, everyone. I am getting a error with following code (C# with SubSonic 3) (Korisnik == User && Uloga == Role) dbPupinDB db = new dbPupinDB(); SqlQuery query = db .SelectColumns( KorisnikTable.IdKorisnikColumn, KorisnikTable.UsernameColumn, KorisnikTable.EmailColumn ) ...

Get Top entries from a table based on some criteria

Hi, I have a table Lets say "TopicComments" which records each comments from every user on a topic. The table has TopicID and UserID as foreign keys and comment date and comment text. So for each user comment, there will be a record with TopicID, UserID, DateTime, and text. i want to retrieve the topics with most amount of comments wit...

ASP.NET Membership setup - Database problems

I am setting up a membership provider, and as a result, I am getting the following error message: An attempt to attach an auto-named database for file C:\Users\Mcoroklo\Desktop\Programmering\Private Projekter\ASP.NET\Helpdesk\Version4\HelpDesk\ClientSite\App_Data\ASPNETDB.mdf failed. A database with the same name exists, or...

DDD Value Object: How to persist entity objects without tons of SQL joins?

Obviously I am wrong in saying that DDD is similar to EAV/CR in usefulness, but the only difference I see so far is physical tables build for each entity with lots of joins rather than three tables and lots of joins. This must be due to my lack of DDD understanding. How do you physically store these objects to the database without sign...

Azure Tables and SQL Server Management Studio

Is there a way to view Azure Tables form SQL Server Management Studio or some similar tool? ...

Meaning of Primary Key to Microsoft SQL Server 2008

What meaning does the concept of a primary key have to the database engine of SQL Server? I don't mean the clustered/nonclustered index created on the "ID" column, i mean the constraint object "primary key". Does it matter if it exists or not? Alternatives: alter table add primary key clustered alter table create clustered index Doe...

SQL Compact error: Unable to load DLL 'sqlceme35.dll'. The specified module could not be found

Hi - I'm developing a Winforms application using Visual Studio 2008 C# that uses a SQL compact 3.5 database on the client. The client will most likely be 32 bit XP or Vista machines. I'm using a standard Windows Installer project that creates an msi file and setup.exe to install the app on a client machine. I'm new to SQL compact so I ha...

SQL Server: Non-null unique vs. Primary Key

Let's say I have some table T with some non-null field A. There is a clustered index on A. Consider the following two options: I make A the primary key. I create a UNIQUE constraint for A. Where's the difference? I know what a primary key is, and I know that there is a conceptual difference w.r.t. database theory. But what is the act...

SQL Sorting Data into a Pattern

Not sure if this is possible, but there might be a creative approach... Given this data in SQL Server 2005: AAA AAA BBB BBB CCC CCC DDD DDD How could I return a result set sorted in a pattern like this: AAA BBB CCC DDD AAA BBB CCC DDD ...

SQL Server 2005 express edition configuration problems

i want to use SQL Server 2005 Express edition as database for my "thesis" but i have a bit of problem configuring it. I've installed SQL Server 2005 Express edition, SQL 2005 Service Pack 3(sp3) and the Sql Server Management Studio Express. I opened up the Sql Server 2005 Surface Area configurations, clicked on Surface are Configuratio...

not null and is unique constraint

Hi, In SQL Server 2005, which system table holds the information as to whether a column is nullable or not, whether a index is unique or not asc or dec. Thanks, Jude ...

Bulk insert XML data into SQL Server

Using the table structure below how would I create a bcp bulk insert that would handle the XML data. It is important that this is run from command line. CREATE TABLE [dbo].[MyTable]( [Id] [uniqueidentifier] NOT NULL DEFAULT (newid()), [MyXmlField] [xml] NULL Thanks in advance... ...