sql-server-2005

sliding window scenario - taking partions offline

Is there a way in MS SQL Server 2005 to take a partition / file groups / files offline? I have a lot of data in certain tables and would like to use the sliding window Scenario: http://msdn.microsoft.com/en-us/library/ms345146%28SQL.90%29.aspx#sql2k5parti%5Ftopic24 Instead of keeping all the data in the first partition, I would like to...

is it possible to get the query plan out using jdbc on sql server?

I am using the JTDS driver and I'd like to make sure my java client is receiving the same query plan as when I execute the SQL in Mgmt studio, is there a way to get the query plan (ideally in xml format)? basically, I'd like the same format output as set showplan_xml on in management studio. Any ideas? Cheers, -James Some code f...

Storing Connection Strings in Registry?

We decided to use the registry for handling our deployment with connection strings in our VB.net application. The requirements are: If the program cannot connect to the server, first check the registry for a connection string. IF not, create the folder and fill in the name, type, and data. Make sure its encrypted. I have never e...

How to Parse and Append text to a stored procedure in SQL Server 2005 via a parameter

Does anyone know of a way to append text to a stored procedure from within another stored procedure? I would like to do something like the following in SQL Server 2005: Declare str as Nvarchar(Max) = '' set @spStr = dbo.spTest + 'Where testCol1 = ''Test''' exec(@spStr) I understand this may open some discussion about SQL ...

Counts for lots of boolean fields in one sql query?

Not sure exactly how to explain this but Imaging you have a table with lots of boolean fields like this...... Table: Cars Columns: Automatic: boolean Silver: boolean American: boolean Noisy: boolean Smelly: boolean fast: boolean (silly fields and most of them wouldn't be bools in reality but just an examp...

Fast way to eyeball possible duplicate rows in a table?

Similar: http://stackoverflow.com/questions/91784 I have a feeling this is impossible and I'm going to have to do it the tedious way, but I'll see what you guys have to say. I have a pretty big table, about 4 million rows, and 50-odd columns. It has a column that is supposed to be unique, Episode. Unfortunately, Episode is not unique...

Sql Server Login failed for user 'sa'. [CLINET: XXX:XXX:XXX:XXX]

Hi, We installed SQL Server 2005 Enterprise Edition in Windows 2003 with all altest SP for both SQL Server & Windows. SQL Server is running perfectly without any problem for sometime. Suddenly it crashed. when look into EventViewer there per second 5 to 10 entries saying that Login failed for user 'sa'. [CLINET: XXX:XXX:XXX:XX...

Export multiple queries to different tables

I need to export; Multiple queries to different tables of ms access database from ms sql. I know it is possible by taking each query and export it to a single table and repeating the same for different queries. What i want to know is... can it be done in one stretch? suppose there are three queries and each query output need to be in...

Does number span exists in database

I hope you can understand my question, if not, please let me know... In my form I have eight textboxes, like so (user wrote '25' to first textbox and '35' to second one): Code1From: _25____ Code1To:_35____ Code2From: _______ Code2To:_______ Code3From: _______ Code3To:_______ Code4From: _______ Code4To:_______ My table looks l...

Help with SQL structure for creating a schedule of notifications

Hi I have the following problem and I am trying to work out what is the best way to solve. I have a table say called [Kpi] and the data would be like this:- [ContractId] [KpiId] [NotificationIntervalInMonths] 1000 1 3 1000 2 5 I have a [Contract] table which contains:- [Contr...

what might cause SQLServer to stop accepting new database connections while preserving old ones?

A working IIS7 website gets restarted and its websites cannot connect to the database server. All code is fine and unchanged and works if I point to another database server. Database server has been restarted and shows no errors. Network connections seem fine (syn-ack ok between servers). The only errors are app pool crash errors on ...

bcp Logon error

I continually get a logon error no matter which logon I use or from what tool I approach this (shell/sqlsms) output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...

SQL script for creating table

I created a SQL script to create a table. Can you please go through it and see if there are any error, or if there is missing something in that script? Or you can tell me any better idea to create table? use nors go CREATE TABLE t_data_dnefrc ( "RTN", adVarChar, 9 AccountNbr adVarChar(17) PRIMARY KEY, FirstName adVarChar(50), MiddleNa...

I need help for writing a Stored Procedures in SQL Server 2005

I’m a newbie in Stored Procedures in SQL Server 2005. Let’s say we have a table with these columns: Id (GUID), UserId (string), DayOfYear (int), Score (int). I need a SP with one input (inputDayOfYear) which copy last day (inputDayOfYear=10 => last day DayOfYear=9) data with new Id but old UserId and Score, and current DayOfYear (th inp...

SQL Server 2008 Sync - How to reinsert conflicting pk rows with new primary key

Can someone point me in the right direction for handling a PK conflict error in c# .net using Sync Framework. I am trying to sync between sql server 2008 and local data cache database (.sdf) and would like to keep BOTH rows that are conflicting in both server and client and NOT allow either the server or client win? I get a pk confli...

Need some help with a SQL Query

Hi all, I need some help with a SQL query for SQL Server 2005. Here is an example of the data in the table to be queried: Id PersonId PayrollNum ContractId PayrollFrom PayrollTo --------------------------------------------------------------------------- 1 432642 85110892 1 01/05/2009 ...

SQL Server 2005 Connection Question

Hi there, In SQL Server 2005, is there a way to specify more than one connection string from within a .NET Application, with one being a primary preferred connection, but if not available it defaults to trying the other connection (which may be going to a diff DB / server etc)? If nothing along those exact lines, is there anything we c...

Full-text index population performance on a SQL 2005 indexed view

I have created an indexed view: CREATE VIEW LogValueTexts WITH SCHEMABINDING AS SELECT ISNULL(LRVS_SLOG_ID*256+LRVS_IDX,0) AS ID,LRVS_VALUE AS Value FROM dbo.LRVS_LogRecordedValues WHERE LEN(LRVS_VALUE)>4 CREATE UNIQUE CLUSTERED INDEX IX_LogValueTexts ON LogValueTexts (ID) On SQL 2005 Standard SP3 it takes forever to populate a full-...

Update table SQL query help

I have a database student(attribute - studentid). studentid is a varchar. Now I want to add 'P' at the end of all studentids. 12 -> 12P 234 -> 234P What will be the sql query for this? ...

Can I select all the tables with more than one update trigger

Can I select all the tables with more than one update trigger? The following code selects all the tables with more than one trigger, but I need only the tables with more than one update trigger. This query also returns tables with one insert trigger and one update one, which is not what I want. SELECT * FROM sys.triggers WHERE parent_id...