sql-server

Database Server 100%, for no reason

Hi, We have a Windows Server 2003 (x64) running as a Database server. The Database is equipped with 32GB of RAM Usually the Database memory usage (Task Manager) is between 5-10%. However sometimes the Database shoots up suddenly to 100% and remains there, randomly and without any changes to code or executions. All sort of research, pa...

Database Design for Filtering Database

Hi All, I'm new to complex database design. I'm currently into a project where the user should be able to retrieve Instructions based on a combination of 18 columns. So my parameter Table has the following columns Job State Manager ProcessCode ProcessType (rest of the columns truncated). InstructionID (FK of Instruction Table) When...

SQL-Server: Define columns als mutually exclusive

Hi, joking with a collegue, I came up with an interesting scenario: Is it possible in SQL Server to define a table so that through "standard means" (constraints, etc.) I can ensure that two or more columns are mutually exclusive? By that I mean: Can I make sure that only one of the columns contains a value? ...

latin-1 to utf-8 data porting

i have an old site whose database is in latin-1 encoding. i have created a drupal site duplicate of old site By default drupal database is in utf-8 encoding now how do i port the database from latin-1 to utf-8 . i tried myself and i get unwanted charachters . how should i do it. ...

Index defragmentation

Hi any body help to tell me how to create a Procedure to defrag index on a daily basis in MS SQL Server 2000. Appreciate your answers Joseph ...

Is it possible to have secondary server available read-only in a log shipping scenario?

I am looking into using log shipping in a SQL Server 2005 environment. The idea was to set up frequent log shipping to a secondary server. The intent: Use the secondary server to serve report queries, thereby offloading the primary db server. I came across this on a sqlservercentral forum thread: When you create the log shipping you ...

Create Master/Detail with Combobox and DataGridView

I have a ComboBox with its elements loaded from a sqlserver table (groups) I also have a DataGridView, linked to another table (users). When I load the form, the combo is filled with groups, and the datagridview is filled with users (all the users) 1) I want to be able to select a group from the ComboBox (dropDownList), and then to r...

Use a LIKE statment on SQL Server XML Datatype

If you have a varchar field you can easily do SELECT * FROM TABLE WHERE COLUMNA LIKE '%Test%' to see if that column contains a certain string. How do you do that for XML Type? I have the following which returns only rows that has a 'Text' node but I need to search within that node select * from WebPageContent where data.exist('/PageCo...

Best way to model page attribute data onto different database tables

I'm developing a website (using asp.net-mvc) with a SqlServer 2005 database. I have numerous database tables which drive content pages for the site e.g. I have a table called Activity: Activity ----------- ID Name So for each activity record, there would be a corresponding 'Activity' page. The same applies for other tables e.g. Locati...

SQL Query Designer

I am wondering what the best (free preferred) sql query designers tools for Windows Vista are? I am looking to create quite complicated INSERTS and UPDATES that involves joins etc and being a SQL beginner would like to use a tool to help design my queries a bit faster. Thanks ...

In SQL Server change column of type int to type text

I would like to change a column in SQL Server from type int, to type text, while maintaining the column name. The table with this column has lots of data, and I do not want to lose it. SQL Server doesn't seem to support implicit or explicit casts from int to text, otherwise this would be pretty simple. So, how would you do it using on...

SQL Bulkcopy for Client / Parent relationship

Hi, we have 2 DataTables in a .NET application having a Client / Parent relationship with millions of rows. This data should be inserted into a SQL Server database via SQL BulkCopy. It is possible that multiple instances of this .NET application run in parallel inserting different data to the same tables. For the automatic generation o...

SQL Server Database schema versioning and update

For my application I have to support update scenarios and the database might be affected. I want to be able to update from an old version to the newest without installing intermediate versions. E.g. Suppose I have version A (the oldest), B (intermediate) and C (new version). I want to be able to update version A straight to version C. ...

find duplicate insert into another table

I have a code that that loads my data into sql table. I want know that is there any way to load data into some other table if there is any duplicate value. if yes can you help me. My query is: "insert into t_DATA_DneFrc (RTN, AccountNbr, FirstName, MiddleName, LastName, Amount) values ('" & rcdDNE("RTN") & "', '" & rcdDNE("AccountNb...

Prefix all columns in T-SQL statement

Hi Given a table "ABC" with columns Col1, Col2 and Col3 it is possible to write the following SELECT Col1 AS 'ABC_Col1', Col2 AS 'ABC_Col2', Col3 AS 'ABC_Col3' FROM ABC This is ok, but i have a table with a not fixed set of columns (users are able to append their own columns) where I still need the column prefix (because it is need...

How do you unflatten a delimited string column field to separate rows in SQL?

How do you unflatten a delimited string column into separate rows? I couldn't find a good simple example in stackoverflow. Do I need to use the PIVOT function? My example: Table - Toys ID - A01 SendNumber - '200, 203, 205’ Owner - Josh Desired end Table ID SendNumber Owner A01 200 Josh A01 203...

Set TDS client_version on connection to SQL Server 2005 from asp.net 1.1

I'm trying to debug a problem along similar lines to this old question: http://stackoverflow.com/questions/1568852/sqldatasource-timeout-ok-in-management-studio Complex stored procedure always times out when run from ASP.NET 1.1 via .NET SQL Client, but runs no problem from SQL Management Studio. I looked at sys.dm_exec_sessions to see ...

Using SQLServer Express edition instead of Compact edition as local database cache?

By default, when you create a local database cache using the wizard provided by Visual Studio 2008, it will create a SQL Server Compact edition database for you, and provide you synchronization capability between the cache and remote SQL Server using Sync Framework (1.0). This allow us to provide the offline capability in our client ser...

Synchronising c#/asp.net booking application

I'm developing an event booking application and am having difficulty figuring out how to manage the booking process. I know about db transactions and a little bit about locking but I have a lot of business rules to validate before a booking can be committed and I'm worried about performance bottlenecks. Here's a summary of what's going ...

Duplicate checking in SQL server - one column or many?

In my line of work, we have to do a lot of duplicate checking on name and address data. In the past, I've always just created an index on the relevant columns and queried against those columns (firstname, lastname, address, city, state, zip, etc...) directly. Lately, I've been wondering if it makes more sense to hash those values before ...