sql-server-2005

Cannot open user default database. Login failed. SQL 2005

I have taken a copy of a database home with me so I can do some testing. However when I try to run a stored procedure I get Cannot open user default database. Login failed.. I have checked and checked and checked I can open tables in the databases login to sql management studio and access the default as well as other databases any idea...

select top 10 records for each category.

I want to return top 10 records from each section in the one query. Can anyone help how to do it. Section is one of the column in the table. Database is sql server 2005. Top 10 by date entered. Sections are business, local and feature For one particular date I want only top(10) business rows (most recent entry), top (10 ) local rows and...

ASPNET 2.0 Membership database

Hi, I have an application database and an aspnetdb database (generated from the ASP.Net 2.0 framework). I have restored both database from production onto my development environment but I am unable to log on with any of the users credentials that work on production. So my question is is there anything that ties the aspnetdb database ge...

PHP/PDO and SQL Server connection and i18n issues

In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server 2005 database and store Russian texts. Database collation is Cyrillic_General_CI_AS, table collation is Cyrillic_General_CI_AS, column type is NVARCHAR(MAX). We tried connecting to a database using two following schemes, both causing different problems. PDO mssql: $dbh ...

Move SSIS Packages from SQL Server 2005 to 2008.

What are best practices for moving/exporting SQL Server Integration Services Packages from a SQL Server 2005 DB over to 2008? What are some of the security concerns? ...

Determine Time Zone Offset in T-SQL

My database application is going to be deployed at multiple sites in different time zones. I need a T-SQL function that will determine the UTC timestamp of midnight on January 1 of the current year for YTD calculations. All of the data is stored in UTC timestamps. For example, Chicago is UTC-6 with Daylight Savings Time (DST), the fun...

Convert SQL Server Database from 2005 to 2000

We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so this should not make the conversion problematic. I should mention t...

Converting XML Datetime to SQL Datetime

I have an XML datatype and want to convert an element into a sql DateTime variable. How? e.g. Declare @Xml Xml Set @Xml = '<Root><DateFrom>2008-10-31T00:00:00</DateFrom></Root>' Declare @DateFrom DateTime Set @DateFrom = ????? How can I set @DateFrom with the date from the xml above? ...

Recommended Hardware to Support Full Text Search in SQL 2005

What is the recommended hardware specifications to support full text search in SQL 2005? We are looking to go in production and I want to make sure the current hardware can accommodate it. To provide the context, We are expecting 2 - 3 million records to be searched by small subset of our users(probably in 100s).The user has the optio...

How to get Visual Studio 2008 to edit SSRS 2005 Report Projects w/o Installing SQL Business Intelligence Development Studio 2005?

I'm trying to determine how to open/edit existing SQL Server Reporting Services (SSRS) 2005 report projects (.rptproj) and reports (.rdl) with Visual Studio 2008, without having to install SQL Business Intelligence Development Studio (BIDS) 2005. ...

SQL 2005 Full-Text Catalog is randomly sloooowww

I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightning fast. Has anyone experienced this issue and was/is there...

Is it possible to automate MS SQL Server (2005) queries via SQL Server Management Studio?

Hi, I have two queries saved on my SQL Server 2005 and I would like to have them running at certain intervals, e.g. every 24 hours. Is there a way to automate these queries and schedule them via SQL Server Management Studio? Thanks for all the help in advance. Ym PS: New here and have intermediate level knowledge of SQL server ...

DBCC CHECKIDENT on a temporary table throwing permissions error for wrong user

I'm logged into a SQL Server 2005 database as a non-sa user, 'bhk', that is a member of the 'public' server role only. The following code tries to execute within a stored procedure called by user 'bhk'. This line of code... TRUNCATE TABLE #Table1 DBCC CHECKIDENT('#Table1', RESEED, @SequenceNumber) WITH NO_INFOMSGS causes this error......

Initialise A Variable With The Output Of A Stored Procedure In MS SQL Server

I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) , @DESC VARCHAR(255) OUTPUT ) AS DECLARE @SERVERNAME nvarchar(30) DECLARE @DBASE nvarchar(30) DECLARE @SQL nvarchar(2000) SET @SERVERNAME = Convert(nvarchar, (SELECT spData FROM dbSpecificData WHERE spLookup = 'CM...

Best software for showing SQL Server Database Structure

I have a MSSQL2005 DB with about 140 tables. I want to create either an accessible diagram or a printable API type document with the table structure. Is there a program that offers this kind of db visualization? I find the diagramming built into SQL Server to be very clunky and very inaccessible for my DB size. ...

In MS SQL Server, is there a way to "atomically" increment a column being used as a counter?

Assuming a Read Committed Snapshot transaction isolation setting, is the following statement "atomic" in the sense that you won't ever "lose" a concurrent increment? update mytable set counter = counter + 1 I would assume that in the general case, where this update statement is part of a larger transaction, that it wouldn't be. For exa...

How do you remove obsolete publications in the Replication Monitor?

Through some bungling in creating and removing publications, I was left with a lot of obsolete publications which for some reason still remains in the Replication Monitor. How do you remove these publications? It doesn't seem to have a clear way to remove them. ...

Records not replicated when inserted by custom replication stored procedure.

I've just recently setup a custom replication for my subscriber database, as described in another post here. Basically, when the publisher pushes a new record to the subscribers, the stored procedure will also insert a replicated time into an extra column in the table, and insert a new record to a log table. My problem occurs when tryin...

Storing a c# DateTimeOffset value in a SQL Server 2005 database

I want to store a a c# DateTimeOffset value in a SQL Server 2005 database. Sql 2008 has this as a built-in-type, but SQL Server 2005 does not. The DateTimeOffset structure has a DateTime value wich I store as DateTime, an an Offset property (of type TimeSpan). Since this is the time zone relative to UTC, presumably it is usally at a wh...

Is there a way I can retrieve sa password in sql server 2005

I just forgot the password. Can anyone help me how to get back the password. ...