sql-server

SQLMembershipProvider - Adding membership to an existing database. Setting permissions

I am adding membership-related schemas to an existing database (lets call it myDatabase) following those instructions. As a results the number of tables, views and stored procedures are being created in myDatabase. The next step is to modify web.config for the application to use CustomizedMembershipProvider <membership defaultProvider...

Visual C# 2008 EE SP1 - Linq to SQL - Data Connection to remote server?

After upgrading my Visual C# 2008 Express Edition to .NET3.5, SP1, I've been unable to create new LINQ to SQL classes using a remotely connected database. I used to be able to do so fine. I open up a project (windows forms, class library, same behavior), and either use the New -> Linq To SQL classes method or go directly for adding the ...

Finding someone's age in SQL

In a SQL Server database, I record people's date of birth. Is there an straight-forward method of working out the person's age on a given date using SQL only? Using DATEDIFF(YEAR, DateOfBirth, GETDATE()) does not work as this only looks at the year part of the date. For example DATEDIFF(YEAR, '31 December 2007', '01 January 2008') retu...

What source control do you use for Report Builder 2.0?

I want to use the new report builder 2.0, rather than the old VS2005 integrated report builder for the new features and ease of use, but source control integration is a must. I don't see any ability to use TFS natively, and I have installed the TFS MSSCCI Provider, all with no love. Does anyone know how to get them to play well, or am ...

SQL Server NOLOCK on queries run for authorization

During the course of our application login there are several queries ran, all around validating the login. In evaluating them I noticed that one of the queries is run without the NOLOCK hint. There does not seem to be any particular danger of dirty read because the data would hardly ever change. Thinking about it from an attempted DOS...

Warm Standby SQL Server/Web Server

Warm Standby SQL Server/Web Server This question might fall into the IT category but as the lead developer I must come up with a solution to integration as well as pure software issues. We just moved our web server off site and now I would like to keep a warm standby of both the website and database (SQL 2005) on site. What are the bes...

System views in MySQL

I'm using system catalog views such as SYS.ALL_ OBJECTS, SYS.FOREIGN_KEYS etc. to get information about my database structure in MS SQL 2005. Are there equivalent functions/views for MySQL (v. 5) servers? ...

SQL User-Defined Functions: Fetching TOP n records in a user-defined function...

How come the following doesn't work? CREATE FUNCTION Test (@top integer) RETURNS TABLE AS RETURN SELECT TOP @top * FROM SomeTable GO I just want to be able to be able to specify the number of results to be returned. [SQL Server 2000.] Thanks! ...

How do I pass a string parameter greater than varchar(8000) in SQL Server 2000?

You get a compilation error if you define the string parameter to have a size greater than 8000 e.g. The size (9000) given to the type 'varchar' exceeds the maximum allowed for any data type (8000). Any ideas? ...

Can't connect to SQL Server using an Alias

I have a SQL Server 2000 install on a server that I am having weird connection issues with. Using SSMS I can't connect to it using an Alias I have setup on Configuration Manager. The Alias is set to use TCPIP which is the first protocol in the order below shared memory. If I use the exact same server name I put into the Alias then I...

Is there a dynamic management view in SQL Server 2005 that pertains to column statistics?

The dynamic management views of SQL Server 2005 can give usage information about table indexes. Is there a similar method for getting usage information about column statistics? In specific, I'm curious if some of the older column statistics I've created are still being used. If not, I'd like to delete them. ...

Is there a 'START AT' equivilant in MS-SQL?

Some databases support commands such as: SELECT TOP 10 START AT 10 * FROM <TABLE> Essentially I need to pull the first 10 records, then the next 10, then the next 10 etc. Maybe there is another way to do this but in the past I've done it like the above for databases that support 'START AT'. ...

indexing large table in SQL SERVER

I have a large table (more than 10 millions records). this table is heavily used for search in the application. So, I had to create indexes on the table. However ,I experience a slow performance when a record is inserted or updated in the table. This is most likely because of the re-calculation of indexes. Is there a way to improve th...

Sql 2008 not allowing me to make changes to a table

Hi, For some reason sql server 2008 is not allowing me to add columns to an existing table. The table is empty btw. Is there a setting that prevents modifying tables in sql 2008? ...

SQL Server 2005 Express in VMware causing very high CPU load

I'm having the problems described in KB937745 - very high CPU usage and the Application Log is reporting something like this: The client was unable to reuse a session with SPID SPID, which had been reset for connection pooling. I've downloaded the hotfixes and I can't run them - I suspect it is because SQL Server 2005 Express Edition ...

Open a .BAS DTS Package in SQL 2000?

You can save a SQL Server 2000 DTS package as a VB .BAS file. Is is possible to open a .BAS file in SQL Server Enterprise Manager (or some other way) to add the DTS package to the server? Initally, it appears that SQL Server only lets you import .DTS files. ...

SQL Server 2000: Server memory / CPU parameters in Query Analyzer

SQL Server 2000: Is there a way to find out server memory / CPU parameters in Query Analyzer? ...

Question Mark in Insert Statement

I've got an SQL query that looks like this: INSERT INTO DB..incident ( incident_number --nvarchar(10) ) VALUES ( N'I?' ) What does the ? do in the value statement? EDIT:: Turns out there's some funny business via triggers and custom datatypes that occur on insert (we've got a bit of a messed up DB.) Given normal sett...

What user account does trusted_connection use in sql2008?

When I set trust connection = yes in my web.config, what user account does it use? Is it the 'NT AUTHORITY\NETWORK SERVICE'? Because I under security in Sql management, I see: NtAuthority/System only?? ...

How to delete all but the latest 20,000 records in MS SQL 2005?

Every night I need to trim back a table to only contain the latest 20,000 records. I could use a subquery: delete from table WHERE id NOT IN (select TOP 20000 ID from table ORDER BY date_added DESC) But that seems inefficient, especially if we later decide to keep 50,000 records. I'm using SQL 2005, and thought I could use ROW_NUMBE...