sql-server

Is it possible to copy the data in a remote MSSQL table to a local Table?

What is the best way to go about doing this? I have found some INSERT statements, but they all seem to work just for inner-database copying. My rendition: INSERT INTO [PROGRAM003].[dbo].[faq] ([id], [category], [question], [answer], [tags]) SELECT ([id], [category], [question], [answer], [tags]) FROM [SQL2005_552664_gsow].[dbo].[fa...

Reporting Services Report Manager Generating Report Message

We are using reporting services for our reports and are currently using the Report Manager application to allow users to run reports. The report manager application can be accessed from outside our firewall, so we have configured reporting services so that the report manager web application is on a separate server than the report server ...

How can I disable logins in SQL Server 2000?

Can anybody please, let me know that how can we disable a login in SQL Server 2000. ...

Copy image data type from one table to another

How do you copy an image data type (or varbinary(max)) from one table to another in SQL Server, without having to save the data to a file first? ...

IHierarchicalDataSource, Hierarchy structure, ASP.NET

I am building a hierarchy structure from scratch and I am trying to determine the best route to take. I found the following link below from another StackOverflow question: Nested Set Model I like the idea of nested sets and have begun to build my database, based on this pattern. I am now unsure how to query the data out in such a w...

Get dates from week number in T-SQL

In Microsoft SQL Server, I have a week number (from DATEPART(wk, datecol)) but what I would like to do is turn this back into the date span for that week. For example, SELECT DATEPART(wk, GETDATE()) yields 10. I would like to derive 3/1/2009 and 3/7/2009 from this number. Does anyone know if this is possible? ...

How do I create tables with sections and headers in ASP.NET?

I have some data that must be presented in tabular form with multiple sections. In particular, Each section of data is broken up (with it's own headers) by day. This is basically a one-off single page deal, and won't really be maintained, so I don't want to put a lot of effort into architecture. I have two tables. HEADERS and ITEMS. ...

How do I remove an Identity completely

I'm currently putting together some changes in our data model which include changing a column (that happens to be part of the primary key) so that it is no longer an identity. Is there a way to do this short of actually removing and recreating the entire column or table? The autogenerated code from SSMS does just that but I was wondering...

How to get a proper count in sql server when retrieving a lot of fields?

Here is my scenario, I have query that returns a lot of fields. One of the fields is called ID and I want to group by ID and show a count in descending order. However, since I am bringing back more fields, it becomes harder to show a true count because I have to group by those other fields. Here is an example of what I am trying to d...

Use a own instance for SqlServer Express?

I'm currently developing an application that needs to store data in it's on database, I'm currently using SQL Server Express 2005 with Advanced Services (because we need full text search capabilities). Local company lore says there have been all sorts of strange problems some years ago when two products used MS SQL Server with the defau...

Remove non-unique ids rows

From a database backup I have records without unique Ids. Some records have unique IDs. Some records with duplicated IDs contains different DateCreated values. Some records with duplicated IDs contains the same DateCreated values. I'm trying to get a MSSql 2005 query will leave only unique ID values with the most recent DateCreated v...

Microsoft SQL Server - Who created a Stored Procedure?

Is there a good way to tell who created a stored procedure in SQL Server 2005 (that also works in 2008)? In SQL Management Studio I can right mouse/properties on a proc to get the created date/time but how do I discover the creator? ...

What is the proper Isolation Level to enable this multiple reader solution?

I have a database table containing a queue of work items processed concurrently by multiple readers, with these requirements: Each item should be processed by one reader only. If a reader fails for any reason, the item should be returned to the queue for another reader to process. Here is the pseudo code of a possible solution, each ...

Set up SQL Server 2005 Reporting DB from SQL Server 2000

We recently moved from a simple DB recovery model (with daily full database dumps) on our SQL Server 2000 Standard database to full recovery -- combined with weekly full database backups, daily incremental, and transaction dumps every 10 minutes. Our previous reporting DB instance (SQL Server 2005) was built from the daily backups which...

What are Covering Indexes and Covered Queries in SQL Server?

Can you explain the concepts of, and relationship between, Covering Indexes and Covered Queries in Microsoft's SQL Server? ...

Can PHP and mssql library select more than 256 characters from a varchar column?

Is there a work around (other than changing the column type to a textfield) for SELECTing a large varchar field using PHP and mssql library? For instance a varchar(500). Does PHP really restrict the number of characters to 255? Is there a way to pull back more than that? ...

Determine Old primary key in a SQL Trigger

I've done this before somewhere I'm sure of it! I have a SQL Server 2000 table that I need to log changes to fields on updates and inserts into a second Logging table. A simplified version of the structure I'm using is below: MainTable ID varchar(10) PRIMARY KEY DESCRIPTION varchar(50) LogTable OLDID varchar(10) NEWID varchar(10) Fo...

Unique constraint on table column

Hi, I'm having a table (an existing table with data in it) and that table has a column UserName. I want this UserName to be unique. So I add a constraint like this: ALTER TABLE Users ADD CONSTRAINT [IX_UniqueUserUserName] UNIQUE NONCLUSTERED ([UserName]) Now I keep getting the Error that duplicate users exist in this table. But I ha...

Strange DataRowView errors when generating large RS reports

I have an ASP.NET application, built over DotNetNuke, used in my university for student management. Any now and then, when generating some long-running report, the application throws an error like this: "DataBinding: 'System.Data.DataRowView' does not contain a property with the name XXXX" where XXX may be different. I have to emphasiz...

How do I specify the database isolation level to be used, at a high level?

I am using TransactionScopes at a high level to wrap some high level code that makes a number of connections to the database. One of the functions I call is a generic read that is used for read only functions where a read uncommitted isolation level is needed. But in some cases it is used as part of large update operation and a read com...