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 > august 2007 > threads for monday august 13

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 31

Loop for a previous value
Posted by Gogzilla at 8/13/2007 8:54:01 PM
Hi all I would like to write SQL command to display as below id Value Result 1 100 100 2 200 100 3 300 110 4 400 129 5 500 156.1 6 600 190.49 Formula for Results =100 for id=1 =100*0.1+100*0.9 for id=2 =200*0.1+100*0.9 for id=3 =300*0.1+110*0.9 for id=4 =400*0.1+...more >>

Grabbing all exchanges assigned to user id
Posted by hedgracer at 8/13/2007 7:16:03 PM
Here is the code: SELECT u.Username, a.Account, SUM(f.Quantity) AS Quantity, x.Name AS 'Exch', u.Name FROM xtUserExchange RIGHT OUTER JOIN tUser AS u ON xtUserExchange.UserId = u.UserId RIGHT OUTER JOIN tExchange AS x ON xtUserExchange.ExchangeId = x.ExchangeId LEFT OUTER JOIN tFill AS f IN...more >>

Need a help...
Posted by GB at 8/13/2007 6:54:14 PM
Hello, I have the following 3 tables: tbl_dett_can_all, OpenIntervals and tbl_stop_can_all. Each of them has two key fields - IBES_TICKER and ESTIM_ID. Now I have a query: SELECT COALESCE (T1.IBES_TICKER, O.IBES_TICKER) AS IBES_TICKER, COALESCE (T1.ESTIM_ID, O.ESTIM_ID) AS ESTIM_ID, ...more >>

buckets of elapsed time
Posted by Duke Carey at 8/13/2007 6:20:01 PM
SQL 2000 SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[ResponseDates]( [TestID] [int] NOT NULL, [NotificationDate] [smalldatetime] NOT NULL, [ResponseDate] [smalldatetime] NOT NULL, CONSTRAINT [PK_ResponseDates] PRIMARY KEY CLUSTERED ( [TestID] ASC )WITH (P...more >>

alter a varchar date
Posted by JR at 8/13/2007 5:53:06 PM
I have a field in the database of varchar(30). It stores a psudo date format like: 15/09/2006 19.12 so DD/MM/YYYY 24HH.MM I want to update another field with this value and change it to MM/DD/ YYYY HH:MM:00 (AM/PM) I am willing to drop off the 24 hour part and just hard code AM or ...more >>

time dependent views
Posted by SOC at 8/13/2007 4:36:17 PM
Hello, A simple view drawn from 3 tables has 10's of 1000's of rows with dates going back 5 years. 2-300 records are added per day. Generally the most recent records are the most popular on any given day. Rather than pulling data from thousands of records each time I'm considering using ...more >>

Importing data Help
Posted by John Wright at 8/13/2007 3:42:59 PM
I have a text file our mainframe spits out 4 times a day. The file is a standard csv file that I can use the import wizard to pick up the file and upload it into my database table with no problems. I have a question though. Every time the file is uploaded from the mainframe, it is possible ...more >>

get inserted orderid in store procedure
Posted by someone NO[at]SPAM js.com at 8/13/2007 3:20:39 PM
Hi, I have an orderid field is identity(identity seed:1) , how to get the inserted value in a store procedure? Thansk. ...more >>



Case function has different behavior in SQL2000 and SQL2005
Posted by kc at 8/13/2007 2:32:01 PM
CREATE TABLE [dbo].[TableA]( [ClickPositionKey] [int] NOT NULL, [ClickPosition] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [RowCreated] [smalldatetime] NULL, [RowModified] [smalldatetime] NOT NULL) GO Insert into TableA(clickpositionkey, clickposit...more >>

Unique Names
Posted by Fred Chateau at 8/13/2007 1:49:33 PM
I have a query above my expertise level that I would appreciate some assistance with. I need a list of unique names from all records where the name field is not unique. In other words, given a set of records where some [Name] fields contain unique data and some do not, I need a list of u...more >>

Insert/Update SP
Posted by geo039 at 8/13/2007 12:53:48 PM
Background: I'm a beginner developer learning when to use the app and when to use the DB to execute what I need. I have two tables in separate databases with employee data. I need to set my asp.net application variable to today so a sp would run based on that. Question: The sp needs to check...more >>

Is there a SQL command that can help me with this?
Posted by Luke Davis at 8/13/2007 12:51:31 PM
I've been programming in C# for about 3 months now and I've completed a previous project that worked a lot with data, so I know the basics. This is what I need to do, try and see what you would do as an expert C# programmer. I have to make a paired sales analysis which takes the same home sol...more >>

SELECT [columns] with ORDER BY - trying to understand why
Posted by Geoff at 8/13/2007 11:48:03 AM
When MSSQL is given a query such as select * from mytable order by col1, col2 on a table with more columns than col1 and col2, and having an index on col1, col2 an execution plan says a sort will be performed. However, given the query select col1, col2 from mytable order by col1, col2 the e...more >>

I need help with standard procedure
Posted by Al at 8/13/2007 11:02:07 AM
I am working in sql server 2000. I have tried to use the following sql in a stored procedure, the syntax checks OK but when I try to save I get an error message saying that I have to set the ANSI nulls and warning due to the fact that I am working with a remotely linked query: ************* ...more >>

using CASE or IF/ELSE in SQL statement
Posted by Bill Nguyen at 8/13/2007 10:52:25 AM
Table 1: tankID classID freight Table 2: Freight1 Freight2 What I need is a statement to select T1.Freight =T2.Freight1 if T1.classID = 1 ELSE T1.Freight = T2.Freight2 Any help is greatly appreciated. Bill ...more >>

newbie: Computing time/date differences across rows
Posted by swpulitzer NO[at]SPAM gmail.com at 8/13/2007 10:52:02 AM
Hi, I need help formulating a query. The basic problem is that I have data in different rows that I need to combine. I'm trying to figure out the time required for different steps. For instance, in the table below: STEP TIME TYPE 1 12:30 start 1 2:00 end 2 3:00 sta...more >>

Trace File
Posted by Ed at 8/13/2007 10:32:05 AM
Hi, I found out in MSSQL\LOG folder, there are some trace files there to trace something like the object change, etc. When did all the trace files get created? is there anyway I can stop all kind of auto-trace? Thanks Ed...more >>

IF...ELSE
Posted by Rob at 8/13/2007 10:00:01 AM
Is it possible to have a Stored Procedure with the WHERE clause built by the results of IF...ELSE statements? If so, how do you do that? Thank you...more >>

Linked servers in Stored procedures
Posted by Anders at 8/13/2007 9:24:01 AM
Hi I do have a severe problem in creating stored procedures containing local and linked (remote) servers. I have on my server created a linked server - say MylinkedServer. In a store procedure I have following: CREATE PROCEDURE sp_Test AS INSERT INTO MylinkedServer.testDB.dbo.Table1 ...more >>

SSIS porting numbers to Excel as text
Posted by doofy at 8/13/2007 9:17:22 AM
I've got an SSIS package that takes data from a SS table, and sends it to an Excel destination. When it lands in Excel, the numeric data is being saved as text, which means the charts that I have pointing to those data areas are not showing any values. If the fields are ints in SS, why a...more >>

Turning columns into rows and aggregating into one column
Posted by Nash at 8/13/2007 9:14:18 AM
Hi I wish to translate a table values so that the columns can be the rows on a different table. For example as below: Table: - outcome, status, action abc Y abc Y def N results to be as : New Table:- description (new table co...more >>

update
Posted by farshad at 8/13/2007 9:02:10 AM
There is a table with a lot of fields. An update query is written such as the following lines: update table1 set field1 = table2.field1, field2 = table2.field2, field3 = table2.field3, .. .. .. where sourcefile = 'filename.csv' and table1.field25 = table2.field25 Questions: 1)...more >>

exclusive ado connection
Posted by Paulo at 8/13/2007 9:00:03 AM
I´m using ado to open connection do sql server and I need to open an exclusive connection. The adModeShareExclusive mode only works for access database. How can I open SqlServer in exclusive mode using visual basic 6?...more >>

Curious use of the REPLACE function
Posted by francis.moore NO[at]SPAM gmail.com at 8/13/2007 8:54:38 AM
Hi, Does anybody know why the REPLACE function is being used in this way? SET @file = REPLACE('C:\Temp\Whatever\Test.txt','/','-') <-- This line SET @bcp = 'bcp "SELECT Column FROM Table WHERE Value LIKE + ' + '''' + 'X%' + '''' + ' " queryout "' SET @bcp = @bcp + @file + '" -U user -P pass...more >>

How to display data in tabular sense?
Posted by Peter at 8/13/2007 8:32:03 AM
Hello, Thanks for reviewing my question. I have not been SQL long and this is probably an easy question. I have the following data 1 A 1 B 1 C 2 A 2 B 3 C I would like to display the data in this fashison. 1 2 A A B B C C Can I do this in a simple select state...more >>

slow in asp fast in Mgmt studio
Posted by Mark at 8/13/2007 8:12:05 AM
I have a query that is taking 9.5 million logical reads in asp, but 100 thousand Logical reads in mgmt studio. It takes 31 seconds in the asp page and .5 seconds in mgmt studio. It normally takes up to 3 seconds to run this sql. (Stored proc). We dropped and recreated it thinking it could h...more >>

Specify weight in proc SQL
Posted by David Billigmeier at 8/13/2007 7:18:06 AM
Is there a way to specify a weight variable when using PROC SQL in SAS? -- Regards, Dave...more >>

Exit Code of (12)
Posted by Michael at 8/13/2007 6:30:38 AM
Hi, I got an error on SQL 2000 server. Result: The task completed with an exit code of (12). What does "Exit Code of (12)" mean? Thank you, Michael ...more >>

stored procedure vs inline query
Posted by Prasad at 8/13/2007 4:58:04 AM
I have a strange issue on SQL Server 2000.. I have a stored procedure with 5 input parameters and the query with in the body of stored proc uses the parameters and returns data. This stored procedure when executed with the parameters is taking around 45 minutes. If I take the body of sto...more >>

urls/ free downloadbable tutorials
Posted by Rahul at 8/13/2007 3:44:13 AM
urls/ free downloadbable tutorials Hi, Can anybody send me some useful urls / free downloadable tutorials for learning and deveploment under following topics. (Both in Sql Server 2000/ 2005) Analysis Service (Dimension/ Cubes) MDX Query Reporting Services Regards Rahul ...more >>

update only digits ignore other characters in a single update statement
Posted by ganesh at 8/13/2007 3:25:17 AM
Hi There, Is there any easy way to update the field with only the digits i've a table's field called x1 which varchar(50) alphanumeric, it contains abc123xy12z like that, i would like to remove all characters except digits, is it possble to do that in a single update statement. I need only ...more >>

Data and log growing
Posted by Roy Goldhammer at 8/13/2007 12:00:00 AM
Hello there I've entered to one of my databases about 500 MB Of data And delete it afterword. I made the same thing on Simple and full recovery model. In both of them in the insert the log file has grouth about 5 Mb On the insert part And when i made delete to all data the log file ...more >>

is there better news Readers other than outlook express ?
Posted by Bassam at 8/13/2007 12:00:00 AM
Hello , To read this newsgroup i use outlook express, is there better newsreader client you can recommend ? Thank you Bassam ...more >>

Return Count results from several queries as single row
Posted by luna at 8/13/2007 12:00:00 AM
I have a few COUNT queries that i run across several tables eg select count(ID) from table1 where .... select count(ID) from table2 where .... select count(ID) from table3 where .... works fine, and the results are returned as 3 4 5 how can i make the results show as 3,4,5 ?...more >>

SQLCMD Truncating results
Posted by ink at 8/13/2007 12:00:00 AM
Hi All I am trying to out put results from a query formatted as HTML to a file but something seems to be truncating the data. A small bit of background on this is that I am not allowed to change any settings on the live server, I can not even create a View or stored procedure with out...more >>

Problem with osql and stored procedure
Posted by Morten Snedker at 8/13/2007 12:00:00 AM
Basics: the result of a sp is to be written to an xml-file. Integration Services is not an option...in this particular case. So I Google'd and stumpled upon the use of OSQL, but: EXEC master..xp_cmdshell "OSQL -E -S -Q 'SELECT AccessUserName,AccessUserEmail FROM dbo.AccessUser WHERE Acce...more >>


DevelopmentNow Blog