sql-server-2008

What is the best practice for secure connection to SQL Server 2008 from .net 4.0?

What is the best practice and most secure solution when connecting from a .NET 4.0 application to SQL Server in 2008? And how is this done in c# / vb? I thought of connecting from the application to the SQL Server's database over an encrypted connection and then by using something called Application Roles. Would this be a good approa...

Database Projects: Visual Studio 2008 vs 2010

I just installed VS 2010 for the purposes of running someone else's DB project that was created using the 2010. In VS 2008 I was able to right click on a SQL file ans select "Run ON" to run the script on a given SQL Server. I don't see this option in 2010. Is it available and if so how do I get access to it? ...

Problem counting item frequency on T-SQL

I'm trying to count the frequency of numbers from 1 to 100 on different fields of a table. Let's say I have the table "Results" with the following data: LottoId Winner Second Third ...

Delphi 6 storeproc on windows 7

I work with Delphi 6 and SQL Server 2008. With Windows Vista everything runs ok. But since i change my OS to Windows 7 all my projects started to show a message when i'm trying to compile them that says "Stored procedure (SPname). Doesn't found or doesn't exist in the server. I look my server and it has the Sp with the correct name. i u...

Easy way to view images in a database

I have a web service that I just coded up that drops an image (png) into my SQL Server 2008 database as a varbinary. Is there a easy tool out there that can let me see that image? I could code up a client, but I would rather just use a tool if one exists. ...

How to add an XML parameter to a stored procedure in C#?

I am developing a C# web application in VS 2008 which interacts with my Adventureworks database in my SQL Server 2008. Now I am trying to add new records to one of the tables which has an XML column in it. How do I do this? This is the error I'm getting: System.Data.SqlClient.SqlException was caught Message="XML Validation: Text nod...

SQL 2008 table locked - can't work out why

I have two databases on one SQL 2008 server. Database 1 seems to be causing a lock on a table on database 2. There no queries are running on database 1 that should affect database 2. Is this normal behaviour? When I view the running queries with this command SELECT sqltext.TEXT, req.session_id, req.status, req.command, req.cpu_time, r...

Migrating an ERP product to SQL 2008 (regular or R2) from 2000.

We are running a version behind the latest for our ERP system which runs on SQL Server 2000. My version is not supported on 2008 (regular or R2). In fact, the latest version of the ERP is not certified to work with R2 (which isn't surprising since it hasn't been released yet) I have done some preliminary testing with 2008 and it appears...

Update query? Or other solution?

I have an Email column with invalid addresses in them e.g. “[email protected],[email protected]”. (It includes the quotes) My select statement cleans these up: SELECT SUBSTRING([Email], 2, PATINDEX(‘%,%’, [Email] – 2)) FROM table WHERE [Email] LIKE ‘”%”’ This works and displays: [email protected] Problem I have is, I have a multitu...

Easy plugin or procedure for sqlserver Management Studio to script row inserts.

I've never been able to find a good script or plugin for sql server Management Studio (2005 and or 2008) for a very common scripting need: specifying a few/all rows in a table and scripting their insert. You can guess my story: I've got some configuration data in my dev db and I need to script it for deployment to UAT and then product...

How to enable an AdventureWorks database in a web application?

I am developing a C#/SQL ASP.NET web application in VS 2008. I want the users to be able to select an Adventureworks table and then an input file. The user is then able to map columns from the file with the selected table. This app works fine now in VS. But when I Browse in IIS, it doesn't show any of the tables. I think this is bec...

cannot read multiple rows from sqldatareader

When I query for only one record/row, sqldatareader is giving correct result but when i query for multiple rows, its giving error on the client side. below is my code. please tell me what is the problem here. [WebMethod] public static string SendMessage(string order) { string Server = "alyeyey"; string...

Analysis Services Partitioning Issue

I have a Measure Group, that is partitioned daily. I can process a particular partition, and the XMLA command completes successfully. Furthermore, I have ensure at least one partition is processed for every Measure Group, therefore my cube is "partially processed" and I should be able to browse it. The problem... no data can be seen i...

How to configure an index.htm file in IIS?

I am running IIS 6.0 on an XP OS using VS 2008 and SQL Server 2008 (Full install). I developed two web apps. Both of these I can run from IIS by setting them to the default website. However, now I tried adding an index.htm file. Real simple; all it has is two hyperlinks to these web apps. But now only the first web app works. The f...

SQLServer 2008 Pivot

I need to show some information in a graph, the data is held in a SQL Server 2008 table. The graph is expecting 2 columns, one for QuestionNumber and the other for Score. The table containing the data has column names that correspond to the question numbers ie A1, A2, A3, A4, B1, B2, B3, B4, C1, C2. Each question is given a score of 1 t...

sqlserver 2008 and sql CE over Microsoft sync framework

Unable to obtain a new server anchor. Make sure that you can establish a connection to the server database and that the SelectNewAnchorCommand property of the DbServerSyncProvider is specified correctly [4/14/2010 12:58:49 PM] Badar Muneer says: An error occurred while starting a transaction on the provider connection. See the inner exce...

Program not connecting to new database

Hi, I moved a VS Solution file from an old PC to a new PC. When I opened the solution in VS2010, I found that the database connections in database explorer was not present. Now I want the project to connect to a SQL Server database which is local to the new PC. I have moved the database files (.ldf and .mdf) to the new location and crea...

SQL CHECK constraint issues

I'm using SQL Server 2008 and I have a table with three columns: Length, StartTime and EndTime. I want to make a CHECK constraint on this table which says that: if Length == NULL then StartTime <> NULL and EndTime <> NULL else StartTime == NULL and EndTime == NULL I've begun to try things like this: Length == NULL AND StartTime <...

How to check connection to database ?

t-sql, sql server 2008 My application must check connection status to database every 5 seconds. I did it as code below: static bool Check() { using (SqlConnection conn = new SqlConnection("Server=WS-01\\ex1; User id=Admin; pwd=123; database=database")) { try { conn.Open();...

vb.net date format from textbox > MS SQL query

Hi folks, I have a date column in a DB tabel that I want to query using a date taken from textbox.text. the user selects a date from the calendar in the format dd/MM/yyyy. I want to use that date to put into a query. How do i format the date to be able to query the database? Dim datefrom As String =txtDateFrom.Text Dim dateto As St...