sql-server

How can I convert a program currently using an Access database to use Microsoft SQL Server?

I have a Windows application written in C# that works with an Access database file. Furthermore, I use some DataSets in my project that work with this Access database. Arising from this, I have two questions: How can I convert the Access database file into an SQL Server database, and How can I convert the project code (using Access Da...

Easy way to find out how many rows in total are stored within SQL Server Database?

I'm looking for easy way to count all rows within one SQL Server 2005/2008 database (skipping the system tables of course)? I know i could use SELECT COUNT (COLUMN) FROM TABLE and do it for each table and then add it up but would prefer some automated way? Is there one? ...

what is the difference about SCHEMA in sql server 2005 and sql server 2008?

what is the difference about SCHEMA in sql server 2005 and sql server 2008? ...

Select * into SqlserverTable2 from SqlExpressTable1, can this be done

Can I Select * into a Sqlserver Table from a SqlExpress Table the way I can from a Sqlserver Table to a Sqlserver Table using Select * into Table2 from Table1 If so, what is the syntax? ...

How do you drop a column with an unamed default value constraint and unknown indexes

What is a method of determining if there is a default constraint on a column and its name, and the names of any indexes in order to drop them before dropping the column? ...

Fixing Foreign Key issues with a legacy database

Tools: SQL2000/5/8, .NET 3.5, C# I have come across an application that has two tables. In “code” the tables look like this: TABLE1 (1——N) TABLE2 So Table1 (T1) has an Id: IdT1 and Table2 (T2) has its id (IdT2) and a foreign key t2.IdT1 This 1.N relationship is code enforced to some degree. There were no FKs in the DB whatsoever. (Wh...

TransactionScope helper that exhausts connection pool without fail - help?

A while back I asked a question about TransactionScope escalating to MSDTC when I wasn't expecting it to. (Previous question) What it boiled down to was, in SQL2005, in order to use a TransactionScope, you can only instance and open a single SqlConnection within the life of the TransactionScope. With SQL2008, you can instance multiple ...

sql query with multiple checkboxlist selected

I have a complex query that includes some dynamic sql which partially depends upon a checkboxlist. Here's the part that has me stumped right now (brain fart?). Simple example: Table A (id, name) Table B (id, Aid, Cid) Table C (id, color) So lets say Table A has: 1, Bob 2, Tim 3, Pete and Table C has: 1, Red 2, Blue 3, Green Now...

Handling View Relationships in the Entity Framework

We have a set of views (quite a few) that we're trying to implement in the Entity Framework with their relationships. These views have primary keys defined but for some reason when I create an Entity model for them I received the message: The table/view 'vwFoo' does not have a primary key defined. The key has been inferred and th...

Find SQL Servers using Java

This might be a basic question, but I tried googling it and couldn't find an answer. I need to make a list of all the SQL Servers on a network. This is very easy to do using the .NET framework (System.Data.Sql.SqlDataSourceEnumerator), but is there also a relatively simple way to do this in java as well? While I was doing my research,...

SQL Server JOIN - displaying two joined values in one query that map to one other table?

Here is an example of the data set I am working with. I am trying to write a query that will allow me to request a row from the items table, and display the User Name from the users table in place of the user ids: Table 1 - users table User ID | User Name -------------------- 12 | Fred 13 | Ted 14 | Ned Table 2 - items...

what's a good enterprise document generation solution? (SQL Server, .NET)

I wonder what "the big guys" use to generate documents. Like credit card statements, insurance documentation, etc. We're investigating changing solutions. Here are the two that I know of: SSRS Crystal Reports Neither of these seem to be able to handle widow/orphan control well. Crystal certainly can't deal with dynamically sized p...

How to access a UniqueIdentifer column from Java's JDBC-ODBC bridge

I'm currently working on a java program that will access an Microsoft SQL Server using the JDBC-ODBC bridge driver provided in the Java distribution. Everything seems to be setup correctly and I can query basic data from the database, but when I try to run a query that gets a UniqueIdentifer field in it, when I do the subsequent Resulet...

SQL Server - join or subquery in update statements?

Is there a reason to use one of these UPDATE statements over the other with regards to performance? UPDATE myTable SET fieldx = 1 FROM myTable AS mt , myView AS mv WHERE mt.id = mv.id UPDATE myTable SET fieldx = 1 WHERE id IN ( SELECT id FROM myView ) ...

SQL Server Import and Export Wizard Error: "Index was outside the bounds of the array" via 32bit ODBC data source?

I get an "Index was outside the bounds of the array." error when I do the following. 1) I launch the Import and Export Data Wizard (32 bit). 2) Data source: .Net Framework Data Provider for Odbc. 3) I provide a connection string and DSN for a 32 bit Progress OpenEdge 10.2A ODBC driver that I've set up. 4) I set up a flat file destina...

Creating field with reserved word name with JPA.

@Column(name="open") Using sqlserver dialect with hibernate. [SchemaUpdate] Unsuccessful: create table auth_session (id numeric(19,0) identity not null, active tinyint null, creation_date datetime not null, last_modified datetime not null, maxidle int null, maxlive int null, open tinyint null, sessionid varchar(255) not null, user_id ...

How to set up a new SQL Server database to allow for possible replication in the future?

I'm building a system which has the potential to require support for 500+ concurrent users, each making dozens of queries (selects, inserts AND updates) each minute. Based on these requirements and tables with many millions of rows I suspect that there will be the need to use database replication in the future to reduce some of the quer...

C# handling result sets from SQL Server

Hi, I have large wait times in ASYNC_NETWORK_IO on my SQL Server and I found this interesting article http://blogs.msdn.com/joesack/archive/2009/01/09/troubleshooting-async-network-io-networkio.aspx the part i find interesting is: Identify large result sets and verify with the application team (or developers) how this is being cons...

Is this query equivalent to SQL Server 2008's OPTIMIZE FOR UNKNOWN?

I'm maintaining stored procedures for SQL Server 2005 and I wish I could use a new feature in 2008 that allows the query hint: "OPTIMIZE FOR UNKNOWN" It seems as though the following query (written for SQL Server 2005) estimates the same number of rows (i.e. selectivity) as if OPTION (OPTIMIZE FOR UNKNOWN) were specified: CREATE PROCED...

Recordset Update errors when updating sql_variant field

I'm using C++ and ADO to add data to a SQL Server 2005 database. When calling the Recordset Update method for a sql_variant column I'm getting the error DB_E_ERRORSOCCURRED and the error message Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. If the value I'm adding is NU...