sql-server

Table to XML using TSQL with facet grouping and counts

I have a requirement to turn a table into XML with counts for values. e.g. Table Id , Type, AnotherType 1, This, Widget 2, This, Fimble 3, That, Widget I want the output something like this. This needs to be dynamic so new columns or facets added would generate the this type of output. <matrix name="Type"> <facet name = "this" co...

SQL Express & IIS - A database won't attach if you manually detached it?

Since the answers did not really cover the problem, I posted this on ASP.Net and completly rephrased it. I will post the edited question here: I have been using the attachDB connection string and I usually deploy to IIS. The site works fine, however, I made some changes to the database and the newest version would not copy as it said ...

[SQL Server 2005] How to create Linked Server targeting remote ODBC?

I have a WebTrends ODBC source on server1 and a SQL Server 2005 on server2. I want to connect to this ODBC from SQL Server on server2. So far, I managed to connect to this ODBC from SQL Server which is on same server, using following definition for linked server: EXEC sp_addlinkedserver @server = N'WT_ODBC', @provider=N'MSDASQL', @da...

fiiling data base randomly

i need to generate my sql server 2005 database for testing a multithreaded application. it must be morre than 3 gb at least, what should i do ...

How can I implement a MultiThreaded Transaction in C#?

I want to run set of different commands on different tables in parallel and in a transactional way, how can I do that? More details: I want all the commands to be distributed over threads but in a single transaction, so if all the threads succeed I'll commit else rollback. ...

Convert Unicode Integer into Unicode Character in SQL Server 2005.

How do you convert a Unicode Integer into a Unicode Character in SQL Server 2005. For example, SELECT UNICODE('$') returns 36. I am looking for a function that takes 36 and returns '$'. ...

Use of '' + in SQL Server 2005 Stored Procedure to build SQL string

Hi I'm building a stored procedure which is rather stretching my experience. With the help of people who responded to this thread http://stackoverflow.com/questions/1863527/nested-if-statements-in-mssql-stored-procedure-select-statement I think I'm most of the way there :) In short, the SP takes a series of paramterised inputs to dynam...

Updating Uncommitted data to a cell with in an UPDATE statement

I want to convert a table storing in Name-Value pair data to relational form in SQL Server 2008. Source table Strings ID Type String 100 1 John 100 2 Milton 101 1 Johny 101 2 Gaddar Target required Customers ID FirstName LastName 100 John Milton 101 Johny Gaddar I am following the strategy given below, Populate the Customer t...

Monitor account activity for SQL Server 2005

I'm looking for the easiest way to view what users are logging into my database. We have some old user accounts that might not be getting used anymore. Instead of just turning them off and seeing who complains, I thought there might be some way to monitor who logs in and runs some type of query over the next month or so. What would be th...

Cannot filter results set in SQL Server query

For some reason I cannot get my results set to restrict products that only have the price status of "normal'. When I use a where clause like where pricestatus like 'normal' the results set also filters other records. Any ideas here? SELECT od.order_id, ISNULL(p.pricestatus,'normal') as pricestatus, ISNULL(od.partnumber,'un...

Is there a free .NET library to convert OSGB36 to WGS84

I need a .NET tool, preferably a library, that I can use in SSIS to convert Northing/Easting information from Collins Bartholomew (bartholomewmaps.com) into WGS84 with a ssrid of 4326 - to be used in SQL Server (Geography). Edit: In response to an answer given, the script looks interesting; do you think it would be easy to create a c# c...

Joining INT column to comma separated list of INTs

I'm running SQL Server 2008, and trying to run some queries on some poorly stored data that I'd rather not go through and try to clean up (millions of rows to deal with). What I have is a log table with some FK data as a comma-separated string in one table, and an integer PK in another table. I'd like to be able to join the FK list of in...

Cleaning up bad comma-separated IDs

Following on from a previous question, I'm trying to clean up some data where IDs are stored as a comma-separated list of values. I need to have these broken out into separate rows. I have what a query that works, but is rather slow. Do you have any ideas that would faster than what I'm doing? SET NOCOUNT OFF DECLARE @Conversion TABLE (...

Best-Practice for SSRS Data Source in ASP.Net MVC Project

I have an existing ASP.Net MVC project that is using entities / repositories in a separate project. I need to add reporting functionality to this project via SSRS and I'm wondering what the best way is to handle data access for it. As I have migrator.net and a repository data layer implemented I feel that using the database directly and...

IndexOf function in t-Sql

Given an email address column, I need to find the position of the @ sign for substringing. What is the indexof function, for strings in t-sql. Looking for something that returns the position of a substring within a string. in c# var s = "abcde"; s.IndexOf('c'); // yields 2 ...

Differences between Database and Schema using different databases?

What are the differences in database terminology between MsSQL and MySQL? Can a mysql instance have more than one database? It appears that it can only create different schemas.. However the sql command is "create database". In MsSQL you can create multiple databases.. each have a default schema of dbo?.. but multiple schemas in a data...

Maximum size for a SQL Server Query? IN clause? Is there a Better Approach

Possible Duplicate: T-SQL WHERE col IN () What is the maximum size for a SQL Server query? (# of characters) Max size for an IN clause? I think I saw something about Oracle having a 1000 item limit but you could get around this with ANDing 2 INs together. Similar issue in SQL Server? UPDATE So what would be the best approach i...

Transferring data from Advantage Database Server to SQL Server

My client is using Advantage Database Server and wants to move to SQL Server but obviously wants to move all his clients data as part of the upgrade over to SQL Server. I've thought about writing an app to do the transfer but thinking it might be more trouble than its worth. What would you recommend? ...

Overcoming .NET problem of displaying binary columns in a DataGridView

If a DataSet contains a column that is a timestamp or other binary value, its associated DataGridView throws an ArgumentException, when displaying any data in that column. That is, assume you have some table containing a binary column such as: CREATE TABLE [dbo].[DataTest]( [IdStuff] INT IDENTITY(1,1) NOT NULL, [ProblemColumn] T...

Is it possible to use .NET's TransactionScope with Sql Server 2005 without allowing promotion to DTC?

I'm dealing with some really pain in the ass servers, and I'd like them to just use transactions without DTC (for now so I can concentrate elsewhere). I use multiple databases within the scope, so the typical behavior is to promote, but I want to avoid it. What would the behavior be of an in-doubt transaction under this model, if it's ...