sql-server

GDR - deploying multiple database targets with one project

I'm using Visual Studio Team System 2008 with GDR Version 9.1.40413.00 and am trying to resolve the issue of deploying a single DB project to multiple databases. For instance if I have a Performance.DB project I would like to deploy databases called Performance, Performance2, Performance3 etc. However it seems if you go to the properti...

SSAS - process top 10K rows of fact table

My environment: SQL Server 2005 for database and SQL Server 2005 Analysis Services. I have a fact table of 78M rows. I want to only process the first 10K rows in my development phase. Other than removing the rows from my Fact table, is there another way of achieving this? ...

bind structured arraylist to database.

I have an arraylist ArrayList backupSpecList = new ArrayList(); And a structure: public struct BackupSpecEntry { //for Multiple BACKUP_SPEC_EXCLUDE_PATHS public string path; public string inclExcl; public byte inclExclFlags; public bool indexContents; public int serverBackupSpecId; public int freq; public int ...

how do I make a composite key with SQL Server Management Studio?

how do I make a composite key with SQL Server Management Studio? I want two INT columns to form the identity (unique) for a table ...

SQL Server 2008 Linked server to Oracle 9i

I found: http://stackoverflow.com/questions/307636/how-do-you-setup-a-linked-server-to-an-oracle-database-on-sql-2000-2005 The DSN tested successfully but after using the stored procedures outlined in the article to create the linked server the 'open query' returned the following message: OLE DB provider "MSDASQL" for linked server "...

SQL Super Search

Does anyone have a good method for searching an entire database for a given value? I have a specific string I'm looking for, it's in TableA, and it's also a FK to some other table, TableB, except I don't know which table/column that is. Assuming there's a jillion tables and I don't want to look through them all, and maybe will have to d...

Join to subquery not working?

I should be able to reference tables in the join clauses from a subquery, shouldn't I? But the following query is giving me errors saying they can't be bound: select * from call c JOIN call_task ct ON c.call_no=ct.call_no AND ct.calltask_no = (select min(ict.calltask_no) FROM call_task ict WHERE ict.call_no=c.call_no) JOIN business b O...

Can't get Ruby ODBC bindings to work in 1.8.6 compiled on snow leopard

I have been trying to get ruby 1.8.6 to connect to a MS SQL Server 2005 on Mac OS X snow leopard following the guide here http://wiki.rubyonrails.org/database-support/ms-sql. I have installed the Ruby ODBC Bindings and the dbi and dbd-odbc gems and ruby was compiled from source. If I run this in irb, DBI.connect('dbi:ODBC:A_DSN', '...

SQL Query to retrieve results from two equally designed tables

How can I query the results of two equally designed tables? if table1 contains 1 column with data: abc def hjj and table2 contains 1 column with data: uyy iuu pol then i want my query to return abc def hjj uyy iuu pol but I want to make sure that if I try to do the same task with multiple columns that the associations ...

arraylist to a table

I have an arraylist called backuplist. this arraylist has structures in it. So what i need to do is transfer this arraylist in a table and then store this table in my SQL database. Anybody with ideas as to what i should do..?? Even if it is a different way to do this please let me know. Thanks ...

SQL Server xml string parsing in varchar field

I have a varchar column in a table that is used to store xml data. Yeah I know there is an xml data type that I should be using, but I think this was set up before the xml data type was available so a varchar is what I have to use for now. :) The data stored looks similar to the following: <xml filename="100100_456_484351864768.zip" ...

Increasing performance on a logging table in SQL Server 2005

I have a "history" table where I log each request into a Web Handler on our web site. Here is the table definition: /****** Object: Table [dbo].[HistoryRequest] Script Date: 10/09/2009 17:18:02 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[HistoryRequest]( [HistoryRequestID] [uniqueidentifier] N...

Using C# to SELECT against Excel, how do I make it case-INsensitive?

This SELECT finds Kelly as expected: select [First Name], [Last Name], Phone from [Data$] where [First Name] like "%Kelly%" In the Excel spreadsheet, the first name is "Kelly" with a capital "K" -- and the SELECT specifies a capital "K" also. However, if the K in > like "%Kelly%" < is LOWER-case -- like "%kelly%" -- then the record is...

T-SQL conditional UPDATE

If I have an update statement like this: UPDATE Message SET Subject = Subject ...will SQL Server actually perform an update or is it smart enough to recognize that no update is really needed? ...

T-SQL conditional UPDATE (v2)

Hi, I have a table: Message (MessageID int, Subject nvarchar(100), Body nvarchar(max)) After a message is being updated on UI, I call a stored proc to update that table. In some cases user might update just subject, in other cases just body. I want this stored proc to only update what has changed, so I'm also passing flags showing wh...

SQL - How to find the highest number in a column?

Lets say I have the following data in the Customers table: (nothing more) ID FirstName LastName ------------------------------- 20 John Mackenzie 21 Ted Green 22 Marcy Nate What sort of SELECT statement can get me the number 22, in the ID column? I need to do something like this to generate a unique ID....

SQL Server - distinct value from multiple(2) columns

suppose I have two columns of integers, A and B. Now I want distinct values from these, meaning if both A and B have 1, I want 1 only once. Note: I am NOT interested in getting distinct rows. I just want to get unique integer values from this table which could either be in A or B I could insert values of A and B in one column of some...

how to calculate count in sql?

I have the following table: memberid 2 2 3 4 3 ...and I want the following result: memberid count 2 2 3 1 ---Edit by gbn: do you mean 2? 4 1 I was attempting to use: SELECT MemberID, COUNT(MemberID) FROM YourTable GROUP BY MemberID ...but now I want find which record which ...

Specifying MAXSiZE for MDF LDF files while creating Database in SQL server 2005

HI There, while we create DB , we specify the maxsize of LDF ,MDF alter database myDB add file (name = mydata, -- alias Filename = 'c:\mydata.ndf', -- physical location Size = 20MB, -- starting size; data/mo Maxsize = 2064) i know the size would be subjective to the deployment . i just want to know , is there any guidelines on how t...

Consolidate databases to one server or spread to many?

Should all of my databases for various apps (Sharepoint, CRM, Commerce Server) be on one VM/server or should I separate them out? I am trying to mimic the server environment and what this question hinges on is whether database tuning involves just the database or working on the server's settings to? I am developing a custom ASP.NET web ...