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 > june 2006 > threads for thursday june 29

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

Search
Posted by Samuel Shulman at 6/29/2006 11:42:05 PM
Hi Since I have never had a good search methods I am looking for some reading material/source code to know what is achievable relatively easily Thank you for your suggestions, Samuel ...more >>


simple query for someone ! need a ickle bit of help
Posted by luna at 6/29/2006 8:44:10 PM
i have a really simple (heh select ID,surname,postcode from table) query that selects from a table 3 columns ID (key field - auto increment) Surname Postcode for example it returns 1 smith blah 2 smith blah 3 smith blah 4 jones test 5 arkwright bl00 5 arkwright bl00 6 smythe w000 ...more >>

Date Conversion Help
Posted by Chamark via SQLMonster.com at 6/29/2006 8:21:51 PM
Here is my query SELECT TOP 1000 Team, Segment, Associate, SUM([Adjusted Weight]) AS [SumOfAdjusted Weight], SUM(ExtSatWt) AS SumOfExtSatWt, SUM(VerSatWt) AS SumOfVerSatWt, COUNT([Surv Strt Tm]) AS [CountOfSurv Strt Tm], [Date] FROM dbo.CSI WHERE ([Dat...more >>

How to assign the result of READTEXT to a variable?
Posted by Jun Yuan at 6/29/2006 8:06:02 PM
Hi, is there a way to store the result of READTEXT function to a variable? Thanks...more >>

Basic Insted Of Insert Trigger
Posted by Paul at 6/29/2006 5:43:04 PM
I am using SQL 2005. Could you please give me the most basic Instead Of Insert Trigger for updating a view composed of two Tables. F0r example: ProductTable Columns are ProductID (int, key) ProductName (varchar) ProductAttribute Columns are Attribute1, Attribute2, ProductID. The View is V...more >>

Performance Problems Restoring SQL 7 Win2000 DB To SQL 2000 Win2003 x64
Posted by Alexander J. Oss at 6/29/2006 4:37:09 PM
I have a new Windows 2003 64-bit server on which I'm running a 32-bit SQL Server 2000. I backed up the database on the old (Windows 2000 SQL Server 7) server, copied the backup file across the network, and restored it on the new server. I'm finding in some cases that I'm getting very, very p...more >>

Join 2 colums
Posted by blackduke77 at 6/29/2006 3:23:39 PM
Hi can anyone help me out here, i have a table which I am importing data into usin SQL 2000 DTS,it has a number of columns but i am only interested in the two shown below. Table name as400DocData PageNum OrderNumber 1 123456 2 123456 1 654321 2 65...more >>

Data is there BUT could NOT find it!
Posted by Seequell at 6/29/2006 3:05:01 PM
Here is the situvation. I can get BO_ID Field Value based on ROW_ID but I could not get the same record if I give the BO_ID Value. Please hava a look at the following query and other details. Can someone explain why and how it happens? Is it due to QUOTED_IDENTIFIER ON/OFF Setting. Let me ...more >>



Advice on SQL statement please.
Posted by Russell Verdun at 6/29/2006 3:01:52 PM
I have a query that generates the dataset below, based on the year being filtered I get the sum of an amount Group By the type. What I would like to do is use the exact qry using a differnet date, to generate a third column called Prior12Mnths. How would I use my qry to accomplish this task. I a...more >>

CTE, I have a dream...
Posted by guercheLE NO[at]SPAM gmail.com at 6/29/2006 2:44:20 PM
If they (CTE) were parameterized, I would stop working user functions for use in only one place. /* * CTE, I have a dream... */ With TopRatedEmployees ( @DepartmentId int ) RETURNS TABLE AS ( SELECT TOP 10 EmployeeId, EmployeeName, Rank FROM Employ...more >>

db connection jump from 350 to 2000
Posted by andrew007 at 6/29/2006 2:04:02 PM
Approximately once a week for the past 3 weeks we have had some issues with the custome web content management system sql database that have caused signification problems with the editorial tool and/or live site rendering. The primary symptoms have been extreme sluggishness in the tool, the pu...more >>

sql 2000 UDF return table function
Posted by WebBuilder451 at 6/29/2006 1:56:01 PM
I'm trying to create a UDF that reutrns a table and i'm attempting to ise conditional logic. So far i'm missing something. It wouldn't be the first time. Anyway, semi psudo code is below: something like this RETURN IF @mode = 1 THEN SELECT X FROM Y WHERE x > 7 ELSE IF @mode = 2 THEN SELEC...more >>

Bulk Insert Problem
Posted by hedgracer at 6/29/2006 1:44:42 PM
I am trying to do a bulk insert with the following statement: BULK INSERT dbo.Rand_By_Day from 'C:\Test\Randfinal.txt' I get the following error: Msg 4861, Level 16, State 1, Line 3 Cannot bulk load because the file "C:\Test\Randfinal.txt" could not be opened. Operating system error code...more >>

Diagram of the SP relations
Posted by Just D at 6/29/2006 1:38:47 PM
All, Is it possible to get something like a diagram of the SP relations? I'm working with one DB and the business logic is done so that the SP can execute another SP inside itself, the next SP can call another one, etc. So that we can get 3-4 different sub-layers inside one SP. If I need to...more >>

SQL Statement for finding duplicates
Posted by rwyarger NO[at]SPAM hotmail.com at 6/29/2006 1:23:36 PM
Hi - Sorry for this post (as I'm sure it's been answered a million times by now), but I wasn't able to find a real clear example of what I am trying to do. I have a customer who has some data that I am wanting to import in through a DTS package. Problem is that there are over 500 records i...more >>

Can't be rocket science to delete data older than 30 days?
Posted by Kevini at 6/29/2006 12:37:01 PM
Can it ? is it this simple? Or is it supposed to > ? DELETE FROM LOGRECS WHERE datediff(d,getdate(), time)<=30...more >>

Select Each User last login time
Posted by Lontae Jones at 6/29/2006 11:59:01 AM
Hello I have a table called Logs which has 4 columns IP varchar(30), Users varchar(30), Logdate (smalldatetime), Logtime varchar(30) Not best table design but its a quick project. I need to find the most recent logdate and time for each user. Example data IP Users ...more >>

Is 'SET NOCOUNT OFF' required?
Posted by Cipher at 6/29/2006 11:30:01 AM
Normally I bracket my stored procedure code with 'SET NOCOUNT ON' and 'SET NOCOUNT OFF' statements. Do I actually have to explicitly add the 'SET NOCOUNT OFF' statement at the end of the Stored procedure or does SQL Server automatically set it to OFF once the stored procedure is finished exec...more >>

CASE function
Posted by Rob at 6/29/2006 10:41:01 AM
Hi, I have a date column where the application users puposely enter a date way in the future as part of their business rule. For instance, entering the year 2033 if the given value for this date column is unknown. I need to programmatically retrieve this date and represent those out-of-w...more >>

Common Table Expressions
Posted by JI at 6/29/2006 9:43:47 AM
Can I use a CTE inside a user defined function? If so, could you lead me to an example. Thanks, ji ...more >>

SQLXML 4.0 "timestamp" updategram question
Posted by Ryan at 6/29/2006 9:36:01 AM
Greetings, We're currently starting to utilize updategrams with SQLXML 4.0 and SQL 2005. Part of the research, at this point, is utilizing optimistic concurrency in the updategram using record timestamps. This seems pretty straight forward, however we're having a problem that's causing me...more >>

Need to calculate a weighted average using sql
Posted by JMainus at 6/29/2006 9:28:02 AM
Help!!! I'm in a time crunch and need to calculate a weighted average. Example: 85% of players will win $10.00, 5% will win $100. I have a table that is storing the counter information. I just drawing a blank!!! Any help is appreciated!!!...more >>

SP Flow of Control
Posted by Brian Shannon at 6/29/2006 9:27:33 AM
What happens when you run a SP inside of another SP? My case: At the beginning of the SP I want to call another SP. If I do this will the called SP finish running before proceeding to run the rest of the code? Or do they run simultaneously? Thanks. ...more >>

help selecting all rows that contains no null value
Posted by timhzhou NO[at]SPAM gmail.com at 6/29/2006 8:48:16 AM
I have data on MS SQL Server that have over 60 columns, I would like to select 30 of these columns that may or may not contain NULL and I don't want to write out all 30 columns and check for IN NOT NULL. Does anyone know how to do that? ...more >>

Identity keys in a One-to-Zero-or-Many relationship
Posted by Richard Carpenter at 6/29/2006 8:19:00 AM
Considering the following: CREATE TABLE CustomerTypes ( PKCustomerType INT IDENTITY (1,1) NOT NULL, CustomerTypeDesc VARCHAR(30) ) GO INSERT CustomerTypes (CustomerTypeDesc) VALUES ('Retail') INSERT CustomerTypes (CustomerTypeDesc) VALUES ('Wholesale') INSERT CustomerTyp...more >>

Insert in every ID
Posted by Hitesh at 6/29/2006 7:57:16 AM
Hi, I have a table with following raws. account Channel abc1 PT abc1 ST abc1 ZZ xyz2 PT xyz2 ST xyz2 ZZ abc2 PT abc2 ST abc2 ZZ xyz3 PT xyz3 ST xyz3 ZZ ...more >>

Exception_Access_Violation Error?
Posted by MVChauhan NO[at]SPAM googlemail.com at 6/29/2006 7:21:47 AM
Hi all, Our production server had a raid failure, which we fixed overnight. This is where the problem started, at least i think. Now all of a sudden(after the server was restarted) i am getting following error, when one of the stored procedure gets executed (I have more then 200 Stored Proc...more >>

Help with Update, then Insert what wasn't updated statement.
Posted by rhaazy at 6/29/2006 7:09:47 AM
Using MS SQL 2000 I have a stored procedure that processes an XML file generated from an Audit program. The XML looks somewhat like this: <ComputerScan> <scanheader> <ScanDate>somedate&time</ScanDate> <UniqueID>MAC address</UniqueID> </scanheader> <computer> <ComputerName>Rya...more >>

Help with a Query
Posted by rhaazy at 6/29/2006 6:49:07 AM
Using MS SQL 2000 I will try and post all relevant information. -------- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblScan_tblAsset]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblScan] DROP CONSTRAINT FK_tblScan_tblAsset GO if exists ...more >>

Announcing_a_new_SQL_Comparison_tool_=E2=80=93_get_your_free_copy,_no_catch
Posted by yoni NO[at]SPAM nobhillsoft.com at 6/29/2006 6:45:27 AM
Nob Hill Software, creator of several SQL Server tools, now have their own SQL Server schema comparison tool. It is Superior to other tools on the market in several ways; You can download your own copy at : http://www.nobhillsoft.com/NHDBCompare.aspx. Since this tool is new, we are mainly look...more >>

Back Up Strategy
Posted by SSUK at 6/29/2006 6:24:02 AM
Would like to take your valuable views on ,What’s the best strategy for Database back up and files back up:- I have few options:- • Using Database Maintenance plan • Using State Store • On SQL Server, using Differential on daily & Complete back on weekend.. • Other options :- ...more >>

date comparison
Posted by Q at 6/29/2006 5:33:45 AM
Hi there! I'm having some problems with a query considering it's performance. I want to make a view of saleslines (table 1) joined with a purchline (table 2). The purchline should show the last purchamount of an item, having the latest date before the salesdate. When running the query I ca...more >>

Query help
Posted by Peter Newman at 6/29/2006 4:29:02 AM
For reasons i wont go into i need to have an identity field when returning a select statement ie Select * from Table1 returnn Field1 field2 etc aa aa aa bb bb bb and i want Field1 field2 etc IDENT aa aa aa ...more >>

Issues with SourceSafe integration with Sql Server Management Stud
Posted by Rowland Shaw at 6/29/2006 1:16:02 AM
We have a Sql Server Manageent Studio Solution, that on loading gives the following error: [ Source Control ] There appears to be a discrepancy between the solution's source control information about some project(s) and the information in the project file(s). To resolve this discrepency...more >>

sp_helpdevice - How do I access the Return Code within TSQL ?
Posted by Mark Moss at 6/29/2006 12:12:24 AM
Ladies / Gentlemen I would like to use the sp_helpdevice with the sp_addumpdevice to check to see if the device is already added before I try to add it again. Set @Return_Code = ( sp_helpdevice 'myDataBase' ) If @Return_Code = 0 then EXEC sp_addumpdev...more >>

Contents of a SP
Posted by Robert Bravery at 6/29/2006 12:00:00 AM
Hi all, How can I select the contents of a SP to a text file Thanks Robert ...more >>

Update DateTime field to Date only
Posted by Peter Hartlén at 6/29/2006 12:00:00 AM
I want to update the DateTime field of a table to contain only Date information. The query below works fine but I wonder if there are better solutions to this? Example: Old values: [id] [inDate] ID1 2006-06-27 06:03:23.230 ID2 2006-06-28 09:03:23.230 New values: [id] [inDate...more >>

alternative to union
Posted by Freddie at 6/29/2006 12:00:00 AM
hi, i have tables like sells, byus, rents, credits they all have a FK to table partners - partner_guid how do i get all sells, buys ... for a given partner w/ 1 query? i`ve been thinking about UNION but it will require(will it ?) me to write all where and join clauses 4 times TIA...more >>

Rights running Exec (SQL)
Posted by Geir Holme at 6/29/2006 12:00:00 AM
Hi all. It looks like I need READ rights on the involved tables using Exec (SQL) within a prosedure instead of SELECT TableName and so on.It is not enough to have EXEC rights on the prosedure itself. Is there any way around this or do I need go grant read rights on all the tables in the SQL s...more >>

Current Process
Posted by ricky at 6/29/2006 12:00:00 AM
Hi I've been told that I can use the following SQL expressions to find out the current SQL being executed under a certain SPID, but for some reason I cannot get this to work. Is there something wrong, in what I have written? --************************************* DECLARE @Handle binary(...more >>

Eleminate trailing zeros in the numeric field
Posted by Subbaiah at 6/29/2006 12:00:00 AM
Hello, I have a numeric field with 4 decimal places. In the select query i want to eliminate trailing zeros. DB Value Result 1.1234 1.1234 1.1230 1.123 1.1200 1.12 1.1000 1.1 1.0000 1 Thanks in advance. M. Subbaiah ...more >>


DevelopmentNow Blog