Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008


all groups > sql server programming > november 2006 > threads for friday november 10

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

restoring SQL Server 2005 backup in sql server 2000
Posted by Jami at 11/10/2006 9:40:13 PM
Hi! Can it is possible to restore backup of a database from sql server 2005 to sql server 2000 or i need to use DTS for this transformayion. Regrads, Jami *** Sent via Developersdex http://www.developersdex.com ***...more >>

combining 2 views into one
Posted by Keith G Hicks at 11/10/2006 9:12:21 PM
I sometimes find myself creating views based on views based on views to get a final result. I do this mostly because at times it's easier for me to follow the flow rather than to get too complex. But I know there are times when I could avoid this altogether. Some are obvious and I go back and cle...more >>

How to use Locking?
Posted by Laura at 11/10/2006 7:49:01 PM
Hi, i'm implemeting kind of a queue in a table in SQL Server 2000. I read the oldest record in a table which Table.Locked = 0 and update it to Table.Locked = 1. The Store procedure is like: Select @id = id from Table where Locked = 0 order by date desc Update Table SET Locked = 1 where id ...more >>

How can I suppress this message?
Posted by Peter at 11/10/2006 4:13:02 PM
I'm getting the message "changing any part of an object name could break scripts and stored procedures" when I issue sp_rename in sql script in SQL Server 2000. How can I suppess this message? Does this happen unconditionally? Thanks....more >>

Import data failed
Posted by fniles at 11/10/2006 3:28:45 PM
I tried to import data from a SQL Server 2000 database in another machine to my machine. The data is about 3 gig in size. When copying the data, it failed with this error "[Microsoft][ODBC Sql Server Driver][SQL Server] UPDATE STATISTICS failed because the followint SET options have incorrect...more >>

Complex query 3 tables
Posted by Alejandro at 11/10/2006 3:23:24 PM
I have been unable to do this query, perhaps an expert can help. I dragged too much and now client needs this urgently, like if they ever don't :) .. anyways, any help is greately appreciated. I am using MS SQL 2000, I have 3 tables. Table#1: Baskets 3 basketid int 4 0 0 basketname nvar...more >>

select * question
Posted by Keith G Hicks at 11/10/2006 3:07:13 PM
I often see people in here getting bent out of shape when posters use "select *" in their code. But I've noticed that it's common practice to do this: SELECT c1, c2, .. FROM SomeTable WHERE NOT EXISTS (SELECT * FROM SomeOtherTable WHERE....) Does SQL know not to actually return all the row...more >>

count (*) with inner join?
Posted by Keith G Hicks at 11/10/2006 2:54:44 PM
I am currently doing the follwoing to get a count of rows in the table "Items": SELECT COUNT(*) AS Total FROM Items WHERE ItemID IN (15,16,17,18,19,20,21,22,23,26) AND ItemID IN (SELECT ItemID FROM GnrtdItems WHERE InvcID IS NULL OR ProdPosted = 0) Items is a pretty small table (only a few...more >>



server role for running profiler
Posted by Pat at 11/10/2006 2:41:04 PM
Hi Freinds, SQL2005 What type of access a user need to run sql profiler on 2005? in 2k user should be SA but in 2005 I know it is chaged , but can't find out what is the min server role requirement for that. thanks in advance, Pat ...more >>

Creating a unique index on a column that has duplicates nulls...
Posted by Brad Pears at 11/10/2006 2:09:58 PM
I am trying to create a unique index on a column that can have nulls in it. I have "unique" checked and "ignore duplicate values" checked. However, when I execute the following SQL statement... "create unique index [idx_unq_UnitPrices] on [dbo].[UnitPrices] ([OptionCode]) with ignore_...more >>

Stored queries in database
Posted by Brandon Lilly at 11/10/2006 1:28:02 PM
I have a web developer that wants me to construct a table that will hold a battery of SQL queries that they can just access and execute at need, rather than storing the queries in views or procedures. To me, this sounds like a "very bad thing" - a slippery slope that leads to web developers...more >>

How do i find indexes of the columns in SQL server 2000
Posted by 001frien NO[at]SPAM gmail.com at 11/10/2006 1:09:54 PM
How do i find indexes of the columns of all the tables of the database.....most importantly in SQL server 2000 Thanks a lot ...more >>

About generate insert statements from script file
Posted by Iter at 11/10/2006 12:57:01 PM
Hi Guys, I remenber there is an undocument stored procedure about generating insert statements from script file. That uses for generate all insert statements from text data file. I forget that stored procedure's name. Can someone could tell me what it is? Thanks. ...more >>

Problems inserting monetary data from stored procedure
Posted by Mitch W at 11/10/2006 12:29:01 PM
Hello, I have a stored procedure that I just migrated to SQL 2005 from SQL 7. It has worked in previous verios of SQL, but does not work now. I have something like: insert into TableA (Account,OutstandingLedger select Account,OutstandingLedger=$0.0 from TableB where ... Account is va...more >>

Insert and Update
Posted by Beginner at 11/10/2006 12:13:01 PM
I have a couple of questions with regards to inserting and updating a lot of information. I want to know the best possible ways. 1) I have a table with over 10 million records and I want to insert into it a million records from another table. Is there a better method than using the INSERT I...more >>

BUG: select @S = @S + C from #T broken in 2005 when #T > 1 row
Posted by dave at 11/10/2006 12:01:01 PM
The select @S = @S + C from #T syntax is broken in 2005 (sometimes) when #T has > 1 row. This nasty bug is popping up in or code after upgrading from 2000 to 2005. I know BOL doesn't talk about this syntax, but it has always worked just fine in the past and it is used all over the place...more >>

Database synchronization question
Posted by segis bata at 11/10/2006 11:42:01 AM
Hello everyone, I'm going to copy all the tables from one database in one server to other database in another server. A couple of days later I will want to copy the new (and updated) records (from those couple of days) instead of copying everything again. Plus, those tables don't have da...more >>

Querying an EAV Table
Posted by Don Miller at 11/10/2006 10:28:32 AM
I'm trying to come up with a query using an entity-attribute-value table. Sample data is listed below: Person Table PersonID PersonName -------- ---------- 1 Mary 2 Joe 3 Paul 4 John Fact Table PersonID Att...more >>

Record Paging
Posted by Chad at 11/10/2006 10:24:50 AM
Is there a better way of doing record paging in SQL then: ALTER PROCEDURE dbo.fh_category_files ( @Category BigInt, @Index BigInt = 0, @Size BigInt = 20 ) AS SET NOCOUNT ON DECLARE @LowerBound BigInt DECLARE @UpperBound BigInt -- Calculate the page bounds SET @LowerBound = @I...more >>

Order Header/Detail Combination Counts
Posted by FriscoSoxFan at 11/10/2006 10:02:48 AM
All, I have a large database that has a basic order header, order detail structure (one to many) I'm looking for a query that will give me a count of each combination of part numbers in orders. In laymans terms: There were 100 orders that contained parts A, B, and C There were 45 orders tha...more >>

add a row to the second table result of the 2 query
Posted by hitesh at 11/10/2006 9:40:55 AM
hi friends QUERY 1 ============= SELECT DISTINCT Products.SerialNo, Products.CompanyName, Products.CustomLab1, COUNT(TagList.TagNumber) AS InventoryCount FROM TagList, Products WHERE TagList.EPCCompanyCode = Products.EPCCompanyCode AND TagList.EPCItemCode = Products.EPCItemC...more >>

add a row to the second table result of the 2 query
Posted by hitesh at 11/10/2006 9:40:29 AM
hi friends QUERY 1 ============= SELECT DISTINCT Products.SerialNo, Products.CompanyName, Products.CustomLab1, COUNT(TagList.TagNumber) AS InventoryCount FROM TagList, Products WHERE TagList.EPCCompanyCode = Products.EPCCompanyCode AND TagList.EPCItemCode = Products.EPCItemC...more >>

signature files
Posted by bindurajeesh at 11/10/2006 8:52:01 AM
I have word documents that have signatures that I want to capture and place in a field so that I can query the table via a web form and place the signature on a web form when a certain name is chosen from a dropdownlist. I have tried to copy and paste into the field with datatype as image and...more >>

Complex SQL subquery
Posted by Jebuz at 11/10/2006 8:51:02 AM
Hi, I have been wracking my brain on this for a while, I don't know if it is even possible! I have one table tblConnectionsLog that stores a history of connections to a monitor. The table structure is as follows: ESerial Port Channel Sensor fkSiteID Date Action SEG ...more >>

The "Like" Comparison
Posted by RitaG at 11/10/2006 8:30:02 AM
Hello. I have to select rows from a SQL table where a column is like about 20 values. Instead of doing "Where MyColumn Like '%Value1%' or MyColumn Like '%Value2%' or MyColumn Like '%Value3%' ...... or MyColumn Like '%Value20%'" is there a more efficient way to achieve the desired results? ...more >>

Concatenate string using Group By
Posted by Stephane at 11/10/2006 8:18:03 AM
Hi, Is there a way to concatenate strings using group by? Like a SUM for strings... For example, I have: userId string 1 A 1 B 2 C I would like to group by userId to obtain this: userId string 1 A B 2 C I'm currently using a ...more >>

need help with query
Posted by Dan D. at 11/10/2006 8:00:02 AM
Using SS2000 SP4. We have some bad in a table that we're trying to find. There are basically two types of rows in the Communication table - rows that have been completed (isComplete=1) and those that are pending (isComplete=0). There should only be one row for each company that is pending (but...more >>

OPENDATASOURCE Authority on SQL Server 2005
Posted by herbray at 11/10/2006 7:55:31 AM
Howdy - - Does anyone know how a user can be granted permission to use OPENDATASOURCE without giving him "sa" role? - - Herb ...more >>

Select Distinct on one field of many
Posted by isporter NO[at]SPAM gmail.com at 11/10/2006 6:58:43 AM
Summary: Effectively to acheive something along the lines of SELECT id1, (distinct id2), AccessCount1, AccessCount2, ..., or in other words, collapse column id2. Structure: I have a M-M Relationship between MenuItems and ContentItems, thus 3 tables, the mediator with fields CI_ID and MI_ID. ...more >>

Inputting a foreign key value
Posted by Ant at 11/10/2006 6:35:02 AM
Hi, I'm currently setting up a one to many set of tables. When I save a record, I am first saving the 'one' side of the data to the parent table, then the 'details' to the child table. I need to supply the child table a foreign key based on the primary key of the parent tbl. My problem i...more >>

session (global) variable in T-SQL?
Posted by bjorn.d.jensen NO[at]SPAM gmail.com at 11/10/2006 5:45:01 AM
Hello! Do this exists in SQL Server 2005? I want to write some code that depends on an session-variable... Best Regards Bjoern ...more >>

Average on a varchar fields
Posted by Jon at 11/10/2006 3:53:02 AM
Hello all, I need to get the average on a number of fileds, but these fields are of type varchar. How would I do this? Thanks, Jon...more >>

Time interval
Posted by sara at 11/10/2006 2:06:53 AM
Hi All, I have the following table (Bookid int, date datetime). I want to find all the durations (continuous days) for which the book is in table. The book can be in the table in seprate duration. e.g. (1234, jan-01-2006), (1234,jan-02-2006), (1234,jan-04-2006) is two durations since 02 and 0...more >>

Left Outer Join - matching changed records?
Posted by Gordon at 11/10/2006 1:09:01 AM
Hi I have files being uploaded on a weekly basis and need to match 3 things, new records, deleted records and records which have changed from the previous week. Policy_live_t = contains previous weeks live records t_policy_new_v = contains this weeks load of refreshed records New recor...more >>

Super manager
Posted by rajalapati NO[at]SPAM gmail.com at 11/10/2006 12:24:05 AM
Hello Every body, I have an requirement where i have an employee table with their managers reported. Let me give you structure of the employee table Empno Empname Mgr 1 Srinivas 1 2 sampath 1 3 raju ...more >>

replace 01/01/1900 with null on select
Posted by mark at 11/10/2006 12:00:00 AM
whats the best way to replace null or '01/01/1900' with '' on a select statement (SP) ? -mark ...more >>


DevelopmentNow Blog