sql-server

Analysis services with non normalized table

I have a table with several million rows. Each row represents a user session. There is a column called user which is not unique. There can be multiple sessions per user. I want to use Analysis services to get me the additional properties per user. Example: How many users (unique!) had a session longer than x minutes. How is that possible...

How to rollback a database deployment without losing new data?

My company uses virtual machines for our web/app servers. This allows for very easy rollbacks of a deployment if something goes wrong. However, if an app server deployment also requires a database deployment and we have to rollback I'm kind of at a loss. How can you rollback database schema changes without losing data? The only thing...

Android - getting data from a server

I've read lots about using local storage for android but how would I connect to an SQL database online to send and get data? For example, if I was making a game and wanted to create a worldwide high score table, how would I store that online and make sure it was only available to that app? Thanks, Jon ...

How do you implement a fulltext search over multiple columns in sql server?

I am trying to implement a fulltext search on two columns which I created a view for: VendorName, ProductName. I have the full text index etc working but the actual query is what is causing some issues for me. I want users to be able to use some standard search conventions, AND OR NOT and grouping of terms by () which is fine but I wan...

Find out which row caused the error

I have a big fat query that's written dynamically to integrate some data. Basically what it does is query some tables, join some other ones, treat some data, and then insert it into a final table. The problem is that there's too much data, and we can't really trust the sources, because there could be some errored or inconsistent data. ...

In a stored procedure how to run a query and conditionally do something

How would I do this in a stored procedure (SQL 2005): count = select count(*) from table1 where line like '%success%' if count > 0: delete from table1 where not line like '%success%' Thanks for any help. My google skills are really failing me today :-( ...

Select row data as ColumnName and Value

I have a history table and I need to select the values from this table in ColumnName, ColumnValue form. I am using SQL Server 2008 and I wasn’t sure if I could use the PIVOT function to accomplish this. Below is a simplified example of what I need to accomplish: This is what I have: The table’s schema is CREATE TABLE TABLE1 (ID INT...

EXTEND_MODEL_CASES SQL 2005 workaround

Hi, I have a time series based mining model in SQL 2005 Analysis Serveries. I understand in 2008 you can do what if analysis by using EXTEND_MODEL_CASES with a Natural Prediction Join. I'm looking for a workaround or some method of doing the same thing but with 2005. My time series has 3 inputs, and one predict_only. I'd like to use th...

Difference between SQL Server and Oracle 'User'

Are there any differences between a user in SQL Server and one in Oracle? If so, what are they? Thanks in advance. ...

concatenating results from SQL query and NULL columns

I need to concatenate several columns of a table into a single value, then show that value in an asp dropdownlist. The SQL code I'm issuing is as follows: SELECT UserID, CustomerNum, UserName + ' - ' + UserAddress + ',' + UserCity + ' ' + UserState AS UserInfo FROM Users WHERE (CustomerNum = @CustomerNum) ORDER BY Use...

Retrieving multiple rows in SQL Server but distinct filtering only on one

I have this: SELECT Product.ProductID, Product.Name, Product.GroupID, Product.GradeID, AVG(tblReview.Grade) AS Grade FROM Product left Join tblReview ON Product.GroupID = tblReview.GroupID WHERE (Product.CategoryID = @CategoryID) GROUP BY Product.ProductID, Product.Name, Product.GroupID, Product.GradeID I would like to retu...

Using VCL for the web (intraweb) as a trick for adding web interface to a legacy non-tiered (2 tiers) Delphi win32 application does make sense?

My team is maintaining a huge Client Server win32 Delphi application. It is a client/server application (Thick client) that uses DevArt (SDAC) components to connect to SQL Server. The business logic is often "trapped" in Component's event handlers, anyway with some degree of refactoring it is doable to move the business logic in common ...

Make a usable Join relationship with LINQ on top of a database CSV design error

I'm looking for a way to fix and/or abstract away a comma-separated values (CSV) list in a database field in order to reconstruct a usable relationship such that I can properly join the two tables below and query them using C# LINQ and its .Join method. Following is a sample showing the Person table and CsvArticleIds field having a CSV ...

Tool for generating flat files from SQL objects dynamically

Hello! I'm looking for a tool or component that generates flat files given a SQL Server's query result (from a stored procedure or a SELECT * over a table or view). This will be a batch process which runs every day, and every day a new file is created. I could use SQL Server Integration Services (DTS), but I have a mandatory requiremen...

Lock Question - When is an Update (U) lock issued?

We are trying to resolve a deadlock problem. The transaction that is getting rolled back is attempting to issue an Update (U) lock on a resource that another transaction has an Exclusive (X) lock on. According to Books Online (http://msdn.microsoft.com/en-us/library/ms175519.aspx), an Update lock is supposed to prevent deadlocks, not ca...

Lock Question - 'U' lock vs. 'X' lock

I have a couple questions concerning Update (U) locks and Exclusive (X) locks. 1) Am I correct that an 'X' lock is put on a resource when the resource is about to get updated? 2) I'm a little fuzzy on U locks. Am I correct that a U lock is applied when a resource is read and SQL Server thinks it might need to update the resource later...

conditional statement in sql server 2k5

How would I filter this query to NOT show any items where "discontinued =1" and quantity=0"? I don't want to exclude all items with a value of discontinued =1. This only applies if the item has the value of discontinued=1 and the quantity =0. select sku,producttitle,location,pt_type as type, vendor_name, active,pricestatus, disc a...

TSD03006: Function: [dbo].[clr_function] has an unresolved reference to Assembly [CLRAssembly.SQL]

I'm using GDR2 (VSTS2008) to deploy a sql clr function to a target db (server: sql server 2008) via Team Build. The error is obvious in that the assembly does not exist on the target server. But, based on the documentation (Deploying CLR ) that there is on this topic, I'm assuming that by simply adding a reference to the assembly in the ...

SQL query to return all rows that contain duplicate data from one field

I have a table with card numbers and names. Some of those names are the same, meaning they have multiple cards. How can I select all the rows where the name occurs more than once? ...

Catch/Raise event on table data update C#

Hi, I have 24/7 service which keeps setup (configuration data) for charging, routing and etc in the Sql Server. Once it is started it loads the data from table using Linq2SQL and use the data through all the application. And we need a solution to update the setup data in the table without restarting the application. So I am interested ...