sql-server

Why isnt sql management studio integrated in visual studio?

I have both SQL Server 2005 and Visual Studio 2008 installed and think it would be really nice to have SQL Management Studio integrated directly within Visual Studio. Is there a way to make that happen? What about in VS 2010 with SQL Server 2008? I find the Visual Studio Server Explorer window to be much slower too than the Object Brow...

Linq to SQL not inserting data onto the DB

Hello! I have a little / weird behaviour here and Im looking over internet and SO and I didn't find a response. I have to admit that this is my first time using databases, I know how to use them with SQL but never used it actually. Anyway, I have a problem with my app inserting data, I just created a very simple project for testing th...

How can I drop a SqlServer Backup Device using SMO in C#?

I can drop a SqlServer Backup Device using SQL-DMO using the following pseudo-code: SQLDMO.SQLServer2 server = New SQLDMO.SQLServer2(); server.Connect("myserver"); server.BackupDevices.Remove("mybackupdevice"); File.Delete(mybackupdevicephysicallocation); SMO.Server.BackupDevices does not appear to have a Remove() method, so how can I...

SQL Server: Granting db_datawriter on all databases

I want to manage permissions and access to a SQL Server database server on a development machine. I've created a local windows group (called DBReaderGroup) and assigned various people to it. The group was created as a SQL Server login successfully: create login [MYMACHINE\DBReaderGroup] from windows My goal is to grant this group read/...

Debugging SQL Server Slowness: Same Database, Different Servers

For a while now we've been having anecdotal slowness on our newly-minted (VMWare-based) SQL Server 2005 database servers. Recently the problem has come to a head and I've started looking for the root cause of the issue. Here's the weird part: on the stored procedure that I'm using as a performance test case, I get a 30x difference in t...

Insert ADO.Net DataTable into an SQL table

The current solution i implemented is awful! I use a for... loop for inserting records from an ADO.NET data-table into an SQL table. I would like to insert at once the data-table into the SQL table, without iterating... Is that possible, or am i asking too much? ...

Using C# & SMO, how do I add a backup device to a SQL Server?

I know how to use C# and SMO to create a file backup on a SQL Server: public void BackupDatabase(Microsoft.SqlServer.Management.Smo.Server server, string databaseName, string backupFilename, string backupName, string backupDescription) { Backup backup = new Backup(); back...

Is it possible to create a text formatted list from SQL Server which can then be processed by a PHP Cron job?

Requirement : Should update MySQL database with that of MS Sql Server updates which reside on Linux and Windows hosting on the same web host 1and1. Accessing each other database from either server is not possible on shared hosting, thanks to 1and1's geniuses.. The solution I chose : I want to output all the active listings in a text for...

TSQL 'Invalid column name' error on value of sproc parameter

here's my code: DECLARE @SQL varchar(600) SET @SQL = 'SELECT CategoryID, SubCategoryID, ReportedNumber FROM tblStatistics WHERE UnitCode = ' + @unitCode + ' AND FiscYear = ' + @currYEAR EXEC (@SQL) When i run this sproc with unitCode = 'COB' and currYEAR = '10', i get the following error: Invalid column name 'COB'. Do...

Unit test insert/update/delete

Hey, I have googled this a little and didn't really find the answer I needed. I am working on a webpage in C# with SQL Server and LINQ for a customer. I want the users to be able to send messages to each other. So what I do is that I unit test this with data that actually goes into the database. The problem is that I now depend on ha...

Can you call a SQL Stored Procedure that returns a record set and have those values loaded into variables?

Hello fellow stackers Please consider the following SQL Server table and stored procedure. create table customers(cusnum int, cusname varchar(50)) insert into customers(cusnum, cusname) values(1, 'Ken') insert into customers(cusnum, cusname) values (2, 'Violet') --The Wife create procedure getcus @cusnum int as Begin select c...

SQL Temp Tables & Replication

I have had an issue with our replication process and would like to salvage some data. I have a process in place where I will connect to each subscriber before flagging them for reinitialization and I will run the below to pull any data they may have entered in during the "dark time". I am pretty sure this will work in a vanilla palace...

Possible to view T-SQL syntax of a stored proc-based SqlCommand?

Hello! I was wondering if anybody knows of a way to retrieve the actual T-SQL that is to be executed by a SqlCommand object (with a CommandType of StoredProcedure) before it executes... My scenario involves optionally saving DB operations to a file or MSMQ before the command is actually executed. My assumption is that if you create a Sq...

Visual Studio and SQL Server - correct installation sequence?

I am rebuilding my development machine. This issue is not new to me, but I don't remember the solution. I started with SQL 2008 Developer, then VS 2008 Pro, then the SQL SP1, then VS SP1. The result is that I cannot open SSIS projects (see the error below). What is the correct order so that I can avoid the installation of SQL Server Expr...

Using SQL Server Intergration Services (SSIS) can you read a file from a FileStream column in SQL Server 2008?

I am trying to create a tool that I can upload different types of files "csv", Excel, XML and load those files into a FileStream column in the database as "Source" untouched over the web. Then using SSIS on the server I want to create a package that will process that file to be loaded into other tables to be used by the web application....

Storing varchar(max) & varbinary(max) together - Problem?

I have an app that will have entries of both varchar(max) and varbinary(max) data types. I was considering putting these both in a separate table, together, even if only one of the two will be used at any given time. The question is whether storing them together has any impact on performance. Considering that they are stored in the hea...

Essential Training Topics for Supervisors of ASP.NET Developers

I have a co-worker who supervises a group of ASP.NET developers who are doing lots of ASP.NET/SQL Server apps. My co-worker was very technical at one time, but his last programming assignment was writing Fortran code in the 1980s. He has asked me to help him gain a deeper knowledge of ASP.NET Web application development to equip him in ...

We have multiple app servers running against a single database. How do I ensure that each row in a queue table only get processed once?

We have about 7 app servers running .NET windows services that ping a single sql server 2005 queue table and fetch a fixed amount of records to process at fixed intervals. The amount of records to process and the amount of time between fetches are both configurable and are initially set to 100 and 30 seconds initially. Currently, my qu...

Keyword to SQL search

Use Case When a user goes to my website, they will be confronted with a search box much like SO. They can search for results using plan text. ".net questions", "closed questions", ".net and java", etc.. The search will function a bit different that SO, in that it will try to as much as possible of the schema of the database rather than ...

SQL Server stored procedure in multi threaded environments

Hi, I need to execute some Sql server stored procs in a thread safe manner. At the moment I'm using software locks (C# locks) to achieve this but wonder what kind of features provided by the Sql server itself to achieve thread safety. It seems to be there are some table and row locking features built in to Sql server. Also from a perf...