sql-server

Why my T-SQL (WHILE) does not work?

Hello, In my code, I need to test whether specified column is null and the most close to 0 as possible (it can holds numbers from 0 to 50) so I have tried the code below. It should start from 0 and for each value test the query. When @Results gets null, it should return. However, it does not work. Still prints 0. declare @hold int decla...

Are there any issues and/or gotchas going from SQL Server Express 2008 to SQL Azure?

I'm sure there are, I'm wondering what they are and if there is any upgrade/conversion documentation relative to taking a standard SQL server database and moving it to SQL Azure. ...

Which strategy to choose for building web based business application

Hi everyone! I'm planing to create an accounting application in asp.net mvc. Each user will pay monthly subscription, I'll provide daily backups, etc. I don't know which strategy to choose: To use SQL CE4 and run application in separate virtual directory for each user. To put everything in a single SQL Server database What are cons ...

Copy from SQL Server 2005 to SQL Server 2008 causes x2 data space #SQLHelp

A colleague of mine is copying data from SQL Server 2005 to SQL Server 2008. The destination database lives on a SQL Server 2008 instance but is set to Compatibility Level 90. The source database lives on a SQL Server 2005 instance and is set to Compatility Level 90. He is using SQL Server Integration Services 2008 to perform the co...

Not sure how to go about joining these two tables.

I had trouble coming up with a title for this question because I'm not really sure how to do what I want, so I'm not sure if "joining" is the best terminology in this instance. I have two tables in my database, Plans and Assumptions that look like the following: Plans Table Plankey ass1 ass2 ass3 ass4 aplan 0 6 5 7 bplan...

Does Entity Framework 4 work with SQL Server 2005?

Does ADO.NET Entity Framework 4 work with SQL Server 2005? I'm having trouble getting EF to work and I'm wondering if it's because of our version of SQL Server. ...

Select a specific column based on another column's value

I have a table like this ID | Type | Val0 | Val1 1 | 0 | A | NULL 2 | 1 | NULL | B I need to select Val0 when the type is 0, and Val1 when the type is 1, and ValN when type is N... How can I do that? ...

how to exclude rows that have duplicates in one field

Hello I have a very simple task, but I cannot find any solution. I have two tables, 'articles' and 'categories' My article table look like this: id | cat_id | title | content 1 1 Blah Content 1 2 1 Blah2 Content 2 3 2 Blah3 Content 3 My categories table look like this: id | title 1 Catego...

How to get results from OSQL.exe without dash characters from the command line?

Is there a way to send a osql query from the command line that returns results that do not include the big long line of dash characters that represent the column width? Here is the sample code I am working with: echo. "%PROGRAMFILES%\Microsoft SQL Server\%SQLVER%\Tools\BINN\osql" -S . -E -Q "SELECT name + ', ' FROM sysdatabases order b...

Suggestions for creating an in-house marketing campaign database in a Microsoft environment?

Hi all, I'd like to create an in-house solution to store marketing segment, list, campaign, and communication data. Right now nothing is centralized/standardized. Data is located on a variety of SQL servers, Access databases, and Excel spreadsheets. It's been a real pain when it comes to reporting/tracking. I'm in a Microsoft SQL Se...

How can I cause a build error due to mismatch between sproc and calling code?

I have a .NET class (for discussion, ClassA) that calls a SQL Server stored procedure (for discussion, fooSproc), processing the results with a SqlDataReader. The rows are processed, and the columns are referenced using the name of the column in the returned result set. For example, where dr is the SqlDataReader, something like dr["col...

Is there a rule to define a primary key on a sql-Server table for access with MS-Access?

Defining some Tables in SQL-Server which will be accessed via ODBC from MS-Access. I'm not sure about it, put i read somewhere that a primary key must bee named with 'aaaaaPK_ColumnName'. The 5 'a' should manage that the PK is listed first in the dialog for all key's in MS-Access. What do you think about that? ...

SQL Compact 4 - Full-text search?

Will SQL 4 have full-text search capabilities? Can't find anything in blogs (including Scott Gu). Thanks. ...

Possible to simulate the mySQL functionality ON DUPLICATE KEY UPDATE with SQL Server

I am using SQL Server 2008, and would like to be able to take advantage of something like mySQL's ON DUPLICATE KEY UPDATE clause for INSERT statements Current legacy code does a delete and subsequent insert that is running into concurrency issues with duplicate key inserts from separate threads: Here is the error I see in my production...

How to create an ADODB Recordset From a Table Valued Function with Named Parameters

This works: Dim rst As New ADODB.Recordset rst.Open "SELECT * FROM dbo.ftblTest(1,2,3)", CP.Connection, adOpenKeyset, adLockReadOnly But it would be nicer to do this: rst.Open "SELECT * FROM dbo.ftblTest(@Param1=1,@Param2=2,@Param3=3)", CP.Connection, adOpenKeyset, adLockReadOnly If I try the second method I get the error: "paramet...

#region functionality in SSMS 2008

Using Sql Server 2008, is there any functionality similar to #region in Visual Studio? I'm aware that nodes appear to allow collapsing of SQL segments, but as far as I know, this is based on the syntax of the SQL statement. While that is close to what I'm after, I'm wondering if there is a way to define a section of code, regardless ...

SQL and ASP HELP!!!!

Hi all, I've been working on this script for the last week or so and i'm having major problems trying to understand why it's not working right. I've got some checkboxes link to email address and all i need is for the corresponding username to go with that email. This script is for users that have registered for different newsletters. ...

Updating table based on 2 tables with RowID is as commonality

Hi there I have a table like this: RowID; ListDescription1; ListNormalisedDescription1; 1 XXXX YYYY NULL 2 ZZZZZ NULL I made a complex transformation/normalisation (removing spaces, replacing space and split) and manage to make the same data turning into: RowID; NormalisedItemDescrption1; 1 XXXX 1 ...

how to use reportservice2005.asmx

Hi there, is there an article that explain how to implement reportservice2005.asmx? thanks ...

SSIS - when a connection is down

Hi. I've got a simple SSIS package that I edit in VS2008. What is basically does is run the same SQL StoredProc, residing in different SQL servers, and aggregating their output into a flat file. Simply put, four OLE DB Data Source going to a 'Union All' to output. If one of the servers is down, how can I make the package skip the valid...