sql-server

Linq to SQL: Varbinary(Max) incremental reads

In SQLServer 2008 stored procedures, SUBSTRING can be used to return only part of a varbinary(MAX) column at a time from a query. Is a similar feature available when using LINQ To SQL via C# directly in the code? EDIT: I mean so that only a set number of bytes are loaded in code from the database and not the entire blob each time only...

SQL Server service broker reporting as off when I have written a query to turn it on

I have made a small ASP.NET website. It uses sqlcachedependency The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. Description: An unhandled exception occurred during the exec...

How to view installed Northwind database?

I have installed a sample database, specifically Northwind from http://msdn.microsoft.com/en-us/library/8b6y4c7s.aspx. After installing the .msi file, I dont see any Northwind database in my local sql express server when using SQL Server management studio. Am i missing a step? Do i have to run some script? ...

Table's key pointing to its own table?

In this image, why is the EmployeeID pointing to it's own table while the order id is not pointing to the order's table. The screenshot is a picture of the northwind database. ...

What are some good, reasonably-priced SQL Server client tools offering Intellisense for SQL?

SSMS 2008 doesn't have SQL Intellisense when connected to SQL Server 2005! I know of 3 products which enable writing SQL with Intellisense. ApexSQL Edit, Red Gate's SQL Prompt Pro & SQL Assistant. However I am looking for a less expensive solution. Any ideas? ...

How to do this data transformation

This is my input data GroupId Serial Action 1 1 Start 1 2 Run 1 3 Jump 1 8 End 2 9 Shop 2 10 Start 2 11 Run For each activitysequence in a group I want to Find pairs of Actions where Action1.SerialNo = Action2.SerialNo + k and how may times it happens S...

Using relationship/foreign key with linq2sql?

Hi there, Can anyone help? I have a created a relationship between my Reservation(prim key) and Insurance(for key) tables and imported into linq2sql and checked my automatically created c# files and sure enough i have reservation.MyFieldNames etc etc PLUS reservation.Insurance which is my relationship but reservation.Insurance i can't ...

SQL fast INSERTs with no UPDATEs

We are using a single table for Auditing in a SQL Server 2008 DB. The single table architecture works nicely, is simple to query, accommodates schema changes. But it is a major bottleneck for the entire DB. All INSERTS and UPDATES have to go through the audit table. We already use NOLOCK HINT for SELECT statements. Since there are no...

Avoiding unnecessary sort in SQL Server GROUP BY?

I have tables of data samples, with a timestamp and some data. Each table has a clustered index on the timestamp, and then a data-specific key. Data samples are not necessarily equidistant. I need to downsample the data in a particular time range in order to draw graphs - say, going from 100,000 rows to N, where N is about 50. While I m...

Alternative to SQL Server for a simple web app

I have a simple app written using SQL Server, Entity Framework, C# and WCF. When I wanted to share this app with my friends, I realised they didn't use SQL Server on their machine. I could go for SQL Server Express edition, as the usage of my app is personal and non-commercial. I found MySQL as a popular alternative to SQL Server. ...

How to Merge SQL Query

Dear Friend i want the Output of the Following Query in One row i want to merge Below SQL Query Help me please select Provider_ID,Circel_ID,count(distinct td_all.ID),t_det.BillNoTemp from TAPINOUT_DIFFERENCES_ALL td_all inner join TransferDetails t_det on td_all.bill_no=t_det.Bill_No where td_all.bill_no not in (select bill_n...

Sql Server Compact Edition database deployment strategy

Hello, I have a question about the most appropriate way to deploy a SQL Server CE database with our client application. I understand we need to install the SQL Server CE prerequisites etc., so this isn't a question about getting it to work. It already does. Right now the way we have it is that we just ship a copy of the .mdf file (co...

listing all friends

I have F.FRIENDID, F.MEMBERID columns in FRIENDS table and M.MEMBERID, M.FIRSTNAME, M.LASTNAME in MEMBERS table. I want to list all friends' of signed in member. Issue here is, signed in member's ID can sometimes be in FRIENDID row or MEMBERID row in FRIENDS table. That is because when member adds another member, his or her ID is recorde...

How do I avoid dynamic SQL when using an undetermined number of parameters?

I have a StackOverflow-like tagging system for a database I'm working on. And I'm writing a stored procedure that looks for results based on an undetermined number of tags in a WHERE clause. There could be anywhere between 0 and 10 tags to filter results. So for example the user could be searching for items tagged with 'apple', 'orang...

Get SQL Server schema via a SQL query?

I've inherited a clunky and horribly un-documented site from a bad developer and am trying to get a look at the database schema. Unfortunately the web host is the worst I've ever dealt with and has no control panel capability for viewing the db schema or even exporting tables. Is there any way that I can get a look at the schema via a S...

TSQL - Non-system tables in an SQL Server 2000 database

How to retrieve the names of Non-system -tables in a database from SQL Server 2000 by a T-SQL query? ...

Changing the size of a column in SQL Server

Hi all, I'm trying to change the size of a column in sql server using: ALTER TABLE [dbo].[Address] ALTER COLUMN [Addr1] [nvarchar](80) NULL where the length of Addr1 was originally 40. It failed, raising this error: The object 'Address_e' is dependent on column 'Addr1'. ALTER TABLE ALTER COLUMN Addr1 failed because one or more objec...

Key in dictionary

I have a table called "X". I am trying to update this table by clicking "update button" in a datagrid. When I do that I am getting with the below error. Item has already been added. Key in dictionary: 'admin' Key being added: 'admin' Description: An unhandled exception occurred during the execution of the current web request. Please ...

I want to delete a SQL db. How can I tell if it is being used?

I have W2k3 SBS running SQL 2005. I want to delete a SQL db. How can I tell if it is being used? Thanks. ...

SQL Server 2008 SSMS won't remember password

SQL Server 2008 doesn't remember password inspite of checking the "Remember Password" checkbox. I was suspecting a reboot would solve the problem. But, the issue persists. Environment: Windows Vista Ultimate, SQL Server 2008 I have been hesitant to post this, as it seems so trivial and weird. ...