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
August 2008
all groups > sql server programming > january 2005 > threads for thursday january 20

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

Are distributed partitioned views supposed to improve performance?
Posted by Ian Boyd at 1/20/2005 10:02:05 PM
In a distributed partitioned view, you split a table into multiple tables of different linked server; and you use a UNION ALL view to join the tables into one logical entity. Most attempts to query the (distributed partitioned) view will result in all the rows in the remote tables to be bro...more >>


Best way to do this
Posted by VNN at 1/20/2005 8:48:38 PM
HI all, I'm new to sql and trying to learn it. I'd like to replace a field in one column but don't know how to get it work 10AA1234_TEST.ABC --> 10AA1234.TEST I'd like to replace the "_" with the "." and get rid off whatever after the "." the the original string. Please advice. Thanks. ...more >>

tricky (for me) SQL problem
Posted by Volker Uffelmann at 1/20/2005 8:40:05 PM
Hi, I have a table like with columns like this: foreignid1 foreignid2 somedate pkid othercols filled with data like this: 28 4185 2005-04-14 00:00:00.000 4385 ... 28 4185 2005-04-15 00:00:00.000 8518 ... 36 4439 2005-01-06 00:00:00.000 4421 ... 36 4439 2005-01-08 00:00:00.000 8480 ... ...more >>

"non" distinct rows???
Posted by Bill Gates via SQLMonster.com at 1/20/2005 8:18:30 PM
Ok, I'm trying to run a query that will leave me with rows that are not distinct. i know how to get the distinct rows but i need to do the opposite. i've been searching for this for an hour. thanks in advance. -- Message posted via http://www.sqlmonster.com...more >>

count
Posted by Rich at 1/20/2005 7:45:02 PM
Hi, I am trying to count the records that are currently stored like this: ss/id Col0 Col1 Col2 Col3 ------------------------------ 100 1 H H S 100 2 H S H 101 1 H H S 101 2 H H S 102 1 S S S 102 ...more >>

SQL Profiler for Specific Database
Posted by DMP at 1/20/2005 6:36:41 PM
Hi, Is it possible to generate SQL Profiler on specific database(pubs) ? thanks ...more >>

SQL precision arithmetic overflow error for numeric and decimal da
Posted by Tariq at 1/20/2005 6:13:02 PM
I've a SQL view performing a number of very precise calculations ie. 495/(1.112 - (.00043499*((Col1 + Col2 + Col3))) + ( .00000055 * ((Col1 + Col2 + Col3)) * ((Col1 + Col2 + Col3))) - (.00028826 * Col4))) - 450)/100 Obviously this sometimes causes a precision issues because the float and ...more >>

Effected table List
Posted by DMP at 1/20/2005 5:49:11 PM
Hi, Is any utility/easyest way to find out the effected tables for a particuler operation ? thanks, ...more >>



Getting string result
Posted by Roy Goldhammer at 1/20/2005 5:23:51 PM
Hello there I've build code on query anlyser that create string with some sql to run. The sql that run on the sting is a simple select I would like to know after I run it if it return any records I run it with EXEC ('string') is there a way only to know if this string has returen any r...more >>

SQL field "binary"
Posted by Test at 1/20/2005 4:32:52 PM
Vendor software set password field as binary in sql server 2000 I would like to write some pages to check the user name and password how can i check and match the field? ...more >>

the char '
Posted by Carlo at 1/20/2005 4:19:27 PM
hi i need to remove the ' character from a string in sql table, how can i call it in a query??? i'd like do something like: SELECT * FROM table WHERE name LIKE (% ' %) thanks Carlo ...more >>

Beware: Timestamps are not contained inside Transactions!!
Posted by Dave Slinn at 1/20/2005 3:44:39 PM
Our databases have tables that use a Timestamp column for row-level concurrency checking. All of our Insert and Update stored procedures have an OUTPUT parameter that is supposed to return the value of @@DBTS (which is the last assigned Timestamp for the current database). This value is then ...more >>

Calendar Table
Posted by Andy Williams at 1/20/2005 3:38:52 PM
Hello all, I'm starting to experiment with an auxiliary calendar table as described in: http://www.aspfaq.com/show.asp?id=2519 Basically I'm trying to determine the numbers of days in a range of dates, taking into account weekdays stored in the calendar table. So if I had this: CREATE...more >>

NOT IN with a subquery
Posted by news.microsoft.com at 1/20/2005 3:20:54 PM
This query returns 155 rows: select distinct dp_source from clients This query returns 97 rows: select distinct dp_source from clients where dp_source IN(select distinct source from applicat) This query returns 0 rows: select distinct dp_source from clients where dp_source NOT IN(select ...more >>

Simply add two columns together
Posted by JJ at 1/20/2005 3:01:02 PM
Hi, I'm a noob when it comes to TSql and Sp's. I just want to add to columns together like so... SELECT MonHrs, TuesHrs, (MonHrs + TuesHrs) as TotHrs From Hours What do I need to do to add these two columns together to get the sum? Thanks, JJ...more >>

How to "flush" printed messages
Posted by Agoston Bejo at 1/20/2005 2:55:23 PM
Hi, I have a stored procedure that takes quite a lot time to execute. (Around 20-30 minutes.) While running, it prints messages with PRINT(), but they only show after the procedure has completed. Is there any way to somehow get the messages (not neccessarily on screen: in a file or anything) in...more >>

xp_smtp_sendmail
Posted by Rob Meade at 1/20/2005 2:40:16 PM
Hi all, I appreciate that this xp is unsupported, but I was hoping that there might be someone here who's run into the same problem and might be able to offer some assistance. When I try to run the procedure (with the example code but changing the server and stuff) I get the following, t...more >>

Error Description
Posted by CPK at 1/20/2005 2:29:43 PM
Hello folks, I very much would like to log errors as they occur. The the following code is immediately after an INSERT and it "almost" works: SET @errnum = @@ERROR IF @errnum <> 0 BEGIN SELECT @errdescr = description FROM Master..sysmessages WHERE error = @err...more >>

Strange behaviour of batch-sp
Posted by Bert at 1/20/2005 2:15:37 PM
I've created a stored procedure to duplicate an order with several child tables. It does the following steps: 1. Insert copy of Order 2. Set Ordernr equal to OrderID 3. Insert copy of OrderProduct 4. Insert copy of OrderKosten 5. Insert copy of OrderTraject 6. Insert copy ...more >>

Record Count Question
Posted by Yoyo at 1/20/2005 2:12:15 PM
Hi all, I have a table that looks like the table below. I would like to count each of the column where the dates fall within this calendar year. I would like to produce an end result that shows counts of each column that fits the criteria. Can someone please help me accomplish this? Thank ...more >>

sql nvarchar(50)
Posted by psb at 1/20/2005 2:00:50 PM
I have a table with a column CategoryName as nvarchar(50). A new category name I am trying to add has 59 charaters in it. I get the typical data will be truncated message. I then increase the table and sp to nvarchar(75), and I am still getting that error. It only allows 50. Are nvarchars st...more >>

how to get the server name ?
Posted by Chris V. at 1/20/2005 12:48:07 PM
Hi, I'm trying to get the name of the server I'm running my SP, but can't have it work. I've found the SP called XP_GETNETNAME, but it does not look to be documented... so, I'm wondering if I should use it. Any idea on how to retrieve the server name into a variable ? thanks, Chris V. ...more >>

refresh logins
Posted by JFB at 1/20/2005 12:22:47 PM
Hi All, After I rebuilt my SQL Server and restore the databases. I have a problem with my logins. To fixed this problem I have to go in each database using sql analizer and refresh the login using sp_change_users_login 'auto_fix', 'loginName' I have more than 20 logins and many databases. Ho...more >>

JOIN Question
Posted by mitra at 1/20/2005 12:15:02 PM
Hello, In my query statement I am joining five tables. The query works fine! However, I am not sure where i have the WHERE clause is the best place. SELECT tb_1.create_date tb_2.email_address, tb_3.file_name, tb_4.virus_name FROM tb_5 INNER JOIN tb_4 ON tb_4.id_viru...more >>

Help with stored procedure
Posted by Aleks at 1/20/2005 12:05:09 PM
I have the following stored procedure, problem is that sometimes there is no value passed on to @expiration, when this happens I get an error. How can I avoid from getting this error ? ----------------------------- create procedure BlueDotSetDocumentononcurrentAP @catalogId int, @UserId...more >>

Finding occurences on a string in a column
Posted by Murray Jack at 1/20/2005 11:48:22 AM
Hello I am looking for a way in SQL to find out how many occurances of the search string are in a field, so for example select paragraphtext, [NumberOfMurrays in field] from Paragraphs where paragraphtext like '%murray%' Order by [NumberOfMurrays in field] Does anyone know how to a...more >>

Remove one subscriber from transactional replication
Posted by Patrick at 1/20/2005 11:34:19 AM
Hi Freinds, SQL 2000 I have a publisher which push to 3 subscribers. How can I drop only one subscriber from the list of subscribers and continue push for two other subscribers. Thanks in advance, Pat ...more >>

Drop an article from transactional replication
Posted by Patrick at 1/20/2005 11:32:45 AM
Hi Freinds, SQL 2000 How can I drop one article ( table ) from transactional relication that I have ? Thanks, Pat ...more >>

How to execute stored procedure from commend line?
Posted by Frank at 1/20/2005 11:13:07 AM
Hi, I have to execute stored procedure that has not records returned from DOS commend line. Any info for it? Regards, Frank...more >>

Data Modeling Question
Posted by kurt sune at 1/20/2005 11:11:43 AM
I am design a database containing BrokerOffices Brokers and BrokerAssistants. (among other things) I do three tables: BrokerOffices, Brokers and BrokerAssistants. All have a 1:M relationship Since an assistant is assitant for one or many brokers I do a table Assistancies containg this M:M re...more >>

Useful Indexes
Posted by Chris, Master of All Things Insignificant at 1/20/2005 10:40:42 AM
Another Newbie question for you guys. Let's say I have two indexes setup in my table. 1. Indexes Col1 only 2. Indexes Col2 only Now I have a query: Select * from MyTalbe Where Col1 = 'ABC' and Col2 = 'XYZ' In this simple example are both indexes used? If no, then I could dro...more >>

Cannot load dll xpstar.dll
Posted by Dan G at 1/20/2005 10:33:41 AM
Using SQL Server Enterprise Manager, I am trying to change the sa password. When I "right click" on sa and select "properties" I receive the error, Cannot load dll xpstar.dll, or one of the DLL's it references. Reasion: 126(The specified module could not be found.). Any help with this will be ...more >>

Timeout after "a while" problem
Posted by Owen Mortensen at 1/20/2005 10:22:56 AM
I've got a strange problem with SQL Server 2000 running on Windows Server 2003. Every few days (after re-booting) the server CPU utilization goes up to between 80% and 95% (but NOT to 100%) and certain connections from our ASP website OR from a VB6 program will not run: they time-out. Afte...more >>

Parameter Sniffing - Need more info
Posted by Mardy at 1/20/2005 10:19:10 AM
I recently learned about parameter sniffing and I understand how to deal with it. What I don't understand is why it happens. Is it a bug? Why does it consistently result in less efficient execution plans? Is it only apparent on multiple processor db's? Are there any other configurations that a...more >>

calculation select question
Posted by Kurt Schroeder at 1/20/2005 10:15:03 AM
I'm getting better!!!....BUT----- here is my query: select count(stkhstBuySell) as cnyBS, s.stkhstBuySell, s.stkhstDate from stkhst s where stkhstCsiSym IN (select unvmemCsiId from unvmem where unvmemUnvID = 47001) and stkhstBuySell IN ('B', 'S') group by s.stkhstDate, s.stkhstBuySell order...more >>

Print line in order by greater value
Posted by gv at 1/20/2005 10:14:27 AM
Hi all, The following below prints out fine. I need to print the line in the order of the greastest to the lowest. using the last variable ending in total? PRINT ' Total for Z'+ SPACE(8) + ' TG = ' + @Z_total PRINT ' Total for H'+ SPACE(8) + ' TG = ' + @H_total PRINT ' Total ...more >>

finding offending data
Posted by Emma at 1/20/2005 9:57:01 AM
I am running the query below against a very large database to convert characters to date and I get the following message: Query: select convert(datetime, datefield,101) Error message: Server: Msg 8115, Level 16, State 2, Line 14 Arithmetic overflow error converting expression to data type ...more >>

Different results from similar code
Posted by John Spiegel at 1/20/2005 9:51:26 AM
Hi all, I have an UPDATE that makes changes on records as determined by a subquery. Oddly (to me at least), the records that get affected by the update are different than those that the subquery itself finds if run separately. Can anyone shed some light on this one????? SET ROWCOUNT 10 UP...more >>

@@ERROR for a batch of commands
Posted by mathiasfritsch NO[at]SPAM gmx.de at 1/20/2005 9:20:47 AM
I have some 100 commands in a batch to setup my Testdata. How can I see at the end of the batch if an error ocured and rollback? I know can store the error after each command, but thats not feasible here. It would be to much code and the testdata not readable anymore, which is an requirement. ...more >>

New Access Path isn't being used by stored proc
Posted by Pam V at 1/20/2005 9:07:04 AM
I've created new indexes where there were foreign key constraints that didn't have an associated index. When I exeucte the stored procedure and use the show plan option, I find the old access path is still being used. When I run the SQL statements in a normal query, the the new access ...more >>

10/3 is not 3.3333... Why?
Posted by Loas at 1/20/2005 8:40:29 AM
Why the result of this script is 3? Is it not shoud be 3.3333???? ---------------------------------------------------- declare @var1 INT declare @var2 INT declare @var3 FLOAT set @var1 = 10 ...more >>

insert with timestamp data...
Posted by angel at 1/20/2005 8:31:08 AM
Query initial: INSERT INTO JOBS VALUES ( '1999-04-15 11:35:28.123000', 'Clerk', 'Associate', 'Description of a clerk position. Some more description.', 'C01' ); Query fixed: INSERT INTO JOBS VALUES ( CAST('1999-04-15 11:35:28.123000' AS timestamp ), 'Clerk', 'Associate', 'Description of a...more >>

search identical fields in large number of records between two tab
Posted by adam at 1/20/2005 8:09:04 AM
Dear Expert, I would like to have your valuable suggestion on solving the large record search issue: The situation is that there are two tables, A and B. Table A has 60000 records and Table B has 40000 records. My goal is to loop through each record in Table B to find out the record that...more >>

strange deadlock
Posted by Sam at 1/20/2005 7:29:02 AM
My user has written a Select that can generate a deadlock everytime. Even on a test system with no other running queries. We've found a way around the problem but don't understand why the solution works. Any help understanding this will be greatly appreciated. Here are the 2 queries: Select...more >>

strange problem with sql
Posted by Joel H at 1/20/2005 7:11:07 AM
I have a vb6 app that is widely used in my organization that accesses an sql 2000 db using ado/oledb. I am randomly getting errors from only one computer (out of ~100). It appears that SQL Server is getting a different sql command than what my code is sending. My vb6 code looks similar to t...more >>

SQL Mail
Posted by Shahriar at 1/20/2005 6:22:44 AM
I am trying to get Sql mail to work. Here is what I have and what I have done. I am using Sql 2000 and just applied sp3a. Also use Outlook 2002 sp1. I am trying to use SQL mail; however, I am not able to see my profile name created under SQL mail. I am able to send/receive emails from out...more >>

Can this work - soft code SP table name in parameter?
Posted by Snoop D at 1/20/2005 6:18:50 AM
Hi folks, I have a database with several tables of different structures, each having an identity column called ID. I want to setup some stored procedures to allow me to delete a record from any table and thought that rather than having one stored procedure per table I could perhaps have on...more >>

Re Naming a Column
Posted by Blond Moment at 1/20/2005 3:06:03 AM
Dear All I have series of columns I would like to rename, so I am using the sp_rename command. EXEC sp_rename 'TABLENAME.[OLDCOL]', 'NEWCOL', 'COLUMN' However I am getting the error message:= Server: Msg 15248, Level 11, State 1, Procedure sp_rename, Line 163 Either the parameter @...more >>

query problem-->help needed
Posted by jahuu at 1/20/2005 1:05:26 AM
Hi, we have next kind of data in our database and we need a query that returns "qty" from last 5 mondays. And from those rows we need to drop out the max and min "qty". Thanks for any help! With best regard, Jahoo date prod warehouse qty (monday)06.12.200...more >>

SUM() Total in hh:mm:ss
Posted by Gary Spence at 1/20/2005 12:59:03 AM
Hi All I need the Sum() total in the following query to be in 'hh:mm:ss' format... SELECT '2/10' As Shift,COUNT(Machines.[Name]) AS 'No Of Stops', Machines.[Name], SUM(DATEDIFF(SECOND, StartDateTime, EndDateTime)) AS 'Total' FROM Downtimes LEFT JOIN Machines ON Machines.[ID] = Downtime...more >>


DevelopmentNow Blog