sql-server

Datatype for storing video in SQL Server 2000

What datatype would be used for storing video files in sql server2000? ...

Adding a data connection to SQL Server 2008 from VS 2008

Im trying to add a connection to a database in SQL Server 2008 using Visual Studio 2008. When testing the connection, it says that it is successful. However, once I said okay, it complains and say: "Cannot add data connection. Object reference not set to an instance of an object." How do I go about adding a data connection to a SQL Serv...

Is there a way to avoid row deletion on an specific table using constrains or triggers?

Is there a way to avoid row deletion on an specific table using constrains? I'd like to (for example) deny row deletion if the id is 0,1 or 2 This is in order to avoid users deleting master accounts for an application, and I'd like to avoid it even if someone tries it (by mistake) using sql directly. Thanks! EDIT: The whole idea of ...

Stored Procedure, can you help me?

Below is my stored procedure. I want use stored procedure select all row of date from tbl_member and insert 2 table. But it's not work. Some one can help me? Create PROCEDURE sp_test AS BEGIN SET NOCOUNT ON; Declare @A Varchar(255), @B Varchar(255), @C Varchar(255), @D int Declare Table_Cursor Cursor For select A, B, ...

MSSQLServer 2008 in virtual pc

What are your experiences with running SQL server in a virtual pc? Currently we have an sql2008 instance running in a virtual machine. Both CPU's hit the roof the moment a query is executed. what are your experiences and what do you suggest in this matter? ...

SQL Server 2005 - closing sleeping connections

I seem to have an app on my Dev server that has lots of open connections (they should be there, but some bad data layer was used to open them, that forgot to close them). I just want them closed so I can keep other apps running on the server. How can I force all the connections to close? ...

Grant Select on a view not base table

This one is on "Experts Exchange". Let's open the answer up to the rest of the world. I have a view which is selecting rows from a table in a different database. I'd like to grant select access to the view, but not direct access to the base table. The view has a where clause restricting the number of rows. Can I grant select to the ...

SQL Help: Select statement Concatenate a One to Many relationship

For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas. Thanks. ...

Procedure expects parameter which was not supplied.

I'm getting the error when accessing a Stored Procedure in SQL Server Server Error in '/' Application. Procedure or function 'ColumnSeek' expects parameter '@template', which was not supplied. This is happening when I call a Stored Procedure with a parameter through .net's data connection to sql (System.data.SqlClient), even though I ...

What's the best way to start and stop SQL Server from the command line?

I need to start and stop SQL Server from the command line. I am willing to write a small C# program if necessary, but I suspect that there's something (PowerShell, maybe?) that currently exists that does this gracefully. Thank you ...

Repeater control to aggregate data?

I have a table with doctor offices and doctors in those offices that I'm populating to a repeater control. The data coming back is not aggregated. So, if there are 2 doctors in 1 office, there are 2 rows, same office, different doctor. Is there a way to aggregate the data so the repeater shows 1 office with all of the doctors from that...

Should we run anti-virus software on our dedicated sql server?

Seems like a waste of resources to me, but our team is currently discussing. What is generally considered the best practice here? ...

Create DataTable with DB table structure.

What is the best way to create a DataTable with the same structure as a table in my SqlServer database? At present, I am using SqlDataAdapter.Fill() with a query that brings back the columns but no rows. That's works fine, but it seems klutzy. Is there a better way? ...

Log changes made to all fields in a table to another table (SQL Server 2005)

I would like to log changes made to all fields in a table to another table. This will be used to keep a history of all the changes made to that table (Your basic change log table). What is the best way to do it in SQL Server 2005? I am going to assume the logic will be placed in some Triggers. What is a good way to loop through all th...

SQL Server 2005 "public" database role doesn't seem to apply?

I have a SQL Server 2005 database that I'm trying to access as a limited user account, using Windows authentication. I've got BUILTIN\Users added as a database user (before I did so, I couldn't even open the database). I'm working under the assumption that everybody is supposed to have permissions for the "public" role applied to them,...

Sql Query Linking Two Tables

Hi there, One doubt in MSSQL. There are two tables in a databases. Table 1 named Property contain fields PRPT_Id(int),PRPT_Name(varchar), PRPT_Status(bit) Table 2 named PropertyImages contain fields PIMG_Id(int),PIMG_ImageName(varchar),PRPT_Id(int),PIMG_Status(bit) These two tables follow a one-to-many relationship. That means the e...

How to import mdb to sql server.

I have a vb application. Now I have developed that same vb application in Asp.net. In vb I had used MSAccess database. In asp.net I am using Sql server. Now I want to Move or copy the MSaccess database data into Sql server. ...

SQL Server to Oracle10g conversion

I currently have a SQL Server (Express 2005) database to hold some transaction/metadata that I now want to migrate to Oracle 10g express instance. Can you do this programmatically or is there a decent software tool that anyone can recommend? ...

Changing ASPNETDB name

Is there anyway to change the ASPNETDB and also using SQLExpress (2005) user instance ? I have changed my web.config's connectin string to <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\Kooft.mdf; User Instance=true; Integrated...

What datatype do you use for enumerations in SQL Server

When we serialize an enum from C# to SQL Server we use a NCHAR(3) datatype with mnemonic values for each value of the enum. That way we can easily read a SELECT qry. How do you save enum to your database? What datatype do you use? ...