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 > july 2003 > threads for wednesday july 9

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

RAISEERROR from within constraint?
Posted by Zig Mandel at 7/9/2003 11:36:01 PM
It appears that RAISEERROR cannot be called from a constraint? If this is the case, how can I display a custom message when validation fails? I know I can do it with a trigger, but in my case it will be much harder to do with a trigger. It seems an unnecesary restriction that I cannot call RA...more >>

Query, Join on nearest
Posted by Tommy at 7/9/2003 9:57:54 PM
Hello, I am in a position where i need to create a query where i must join two tables on the nearest value. Imagine i have 2 tables, tbl_Trade and tbl_Time. For each Time in tbl_Time, I need to locate the row in tbl_Trade where tbl_Time.LastUpdate is closest to, but less than the value of tb...more >>

SQLMail with outlook and modem
Posted by Daniel at 7/9/2003 6:21:28 PM
Hi guys i've a problem a sql server begin the service sqlmail with profile (testing perfect), but when send my email with xp_sendmail or send an email with outlook so: Algunos de los destinatarios no recibieron su mensaje. Asunto: hi, this is a sample Enviado el: 09/07/2003 0...more >>

Apostrophe in a string
Posted by Ron Hinds at 7/9/2003 5:55:06 PM
I'm new to SQL Server programming (I've been using Access) and wanted to know: How do I put an apostrophe in a string, if the apostrophe is the string delimiter? TIA ...more >>

Need Urgent assistance with a SQL Query
Posted by Sandeep Commar at 7/9/2003 5:38:25 PM
I would really really appreciate help with this issue. I have an accounting database which has tables which have the cpnyid field and the subaccount field. I am trying to update the cpnyid field in the tables based on the first character of the subaccount. For e.g Where the subaccount is...more >>

Best way to query a flat fixed length text file
Posted by Random at 7/9/2003 5:20:20 PM
I am trying to insert a semi fixed length file into a SQL database. Does anyone know of a way to query a fixed length file like you can a csv to only insert the records that meet certain criteria? So far, I have had success using vbscript to open the file and then parse out the lines, but I am ...more >>

Question on triggers and special 'deleted' 'inserted' tables
Posted by Zig Mandel at 7/9/2003 4:58:48 PM
The documentation seems missing on this topic: Does a trigger gets called once per each row updated/deleted/inserted, or only once per operation (say if I do a several row deletes on the table within a transaction frame) If so, does that mean that the virtual tables 'deleted' and 'inserted' ...more >>

Replace .0
Posted by John McDermidt at 7/9/2003 4:57:48 PM
I have imported some data form XL that seems to have attached .0 to each INT .... is there a way I can replace this .0 with nothing? ...more >>



Search and replace
Posted by John McDermidt at 7/9/2003 4:53:13 PM
I'm certain this has been asked 1000 times.. however ... I recently imported some data - all INTs ... from an excel sheet, but the damn thing taacked on ..0 to EVERY value. Is there a quick way to remove the .0 ?? ...more >>

Ban the cursor!
Posted by Bob Castleman at 7/9/2003 4:17:54 PM
Sorry for the length. Using: CREATE TABLE [EventLog] ( [DatabaseName] [char] (30) NULL , [EventTime] [datetime] NULL , [EventDesc] [varchar] (60) NULL , [EventType] [varchar] (20) NULL , [UserName] [varchar] (15) NULL , [Version] [char] NULL ) INSERT INTO EventLog Values('d...more >>

Profiler Question (Stored Procedures)
Posted by Amos Soma at 7/9/2003 3:48:21 PM
I'm confused on the difference between RPC and SP. In a trace I set up, I track both RPC:Completed and SP:Completed. When I run an app that makes a stored procedure call, there is a RPC:Completed entry and an SP:Completed entry for the stored proc. However, the SP:Completed entry has nothing f...more >>

SQL-server-VB60: error on .recordcount??
Posted by Dennis Snoeys at 7/9/2003 3:47:57 PM
When I open a SQL-Server 2000 table in VB60 the recordset-property returns -1 when there records in the table. I don't want to use cursorlocation=adUseClient. because this gives troubles with my floating point numbers. If I use the cursorlocation=adUseClient it works fine, but if I use Access20...more >>

SQL Server - Alternate for First() Last() functions available in MS Access
Posted by Arun Subramanian at 7/9/2003 3:32:46 PM
Hi, I am trying to find out an alternate way to implement the First() & Last() functions (MS Access) in the SQL SELECT statement of SQL Server. Here is the actual problem I am facing: I am having a table Table1 Name SeqNo Nam1 4 Nam1 5 Nam1 1 Nam2 10...more >>

Removing Trailing Slash
Posted by Jason Davis at 7/9/2003 3:30:15 PM
Hi there, I have a url_address field (varchar(300)) Some records has a trailing slash (/) , some not. For example: http://www.cnn.com/ http://www.cnn.com Is there a way to UPDATE the table to remove the trailing slashes for the relevent records? ...more >>

Query execution time?
Posted by Clive at 7/9/2003 3:03:23 PM
Hi all, 1. Select * from table where ADEDATE = '23 June 2003' in SQLServer2000 This one works fine immediately. 2.Select * from table where convert(char(10),ADEDATE,121) = convert(char(10),getdate(),121) This takes a lot of time and also the consumes the complete resources of the...more >>

Using a table from seperate database?
Posted by Jason Reljac at 7/9/2003 2:55:48 PM
Howdy, Is it possible to use a table located in one SQL database in another database? I have two databases, DB1 & DB2 DB1 has a table named T1 I'd like to use T1 in DB2, (as well as DB3, DB4, etc...) Is there a way to do this? Is it possible to create a view to do this. Thanks, Ja...more >>

HELP: SQL script to backup all databases
Posted by NoSpam at 7/9/2003 2:40:43 PM
I would greatly appreciate some help, or a point in the right direction, please. I am new to MS SQL Server administration, and specifically scripting for MS SQL Server. I want to create a SQL script that would list the names of all databases to a text file, then I want to use a loop-statement...more >>

Object property question
Posted by Adrian at 7/9/2003 2:39:24 PM
SQL Server 2000 If I run the following query using Query Analyser from the 'testdata' database the OBJECTPROPERTY of user tables is 1. But if I run it from another database (which is what I want to do) user tables (and some others) return a null value. select OBJECTPROPERTY(id, N'IsUserTabl...more >>

Profiler Question (Scans)
Posted by Amos Soma at 7/9/2003 2:39:08 PM
I have a couple questions regarding understanding Scan profiler output. 1) Sometimes the IndexID data column will contain a value that does not correspond to any index on the associated table. Why is this? 2) How can I tell when a table scan is being done? Thanks very much. ...more >>

Decimal to Hexadecimal Conversion
Posted by news at 7/9/2003 2:19:15 PM
Hi ! How to convert decimal value to hexadecimal ? thx ...more >>

Ordered Data Inserted into TEMP table, is Read out in Different ORDER??
Posted by RKD at 7/9/2003 1:53:34 PM
Im using a query with OrderBy clause to populate a temp table. The Query works and Order and everything is Fine But when reading the data out of the temp table, some of the rows are positioned wrongly??? ie in the wrong order 75% of the ordering seems fine but a few rows are in the wrong places ...more >>

Nested Queries
Posted by Brian Shannon at 7/9/2003 1:33:53 PM
I have a user defined table with a variety of information with a variety of meanings. Each record has an identifing key from another table associated with it to tell me what the data means. Problem: I need to pull out 5 groups of informaion from the user defined table that links to tabl...more >>

SET IDENTITY_INSERT from OLEDB code
Posted by Ramon de Klein at 7/9/2003 1:26:09 PM
I use OLEDB to insert data into a table, but I get an DBSTATUS_E_PERMISSIONDENIED when inserting data into an identity column. I guess this happens because the IDENTITY_INSERT is disabled (by default) for the table. Not all of my tables use identity columns, so I want to do something like this: ...more >>

Repositioning a Column
Posted by Kartic at 7/9/2003 1:09:25 PM
How do I reposition a column through SQL (Without using enterprice manager). In a table I have a column ServiceID at column number 5, How do I move it to column 2 Thanks ...more >>

Need Query Help
Posted by Aaron at 7/9/2003 12:32:56 PM
Using the following schema is it possible to write a query that will return this data in a single row? TABLE SCHEMA: CREATE TABLE [dbo].[Items] ( [ItemID] [int] IDENTITY (1, 1) NOT NULL, [Name] [varchar] (32) ) ON [PRIMARY] GO CREATE TABLE [dbo].[ItemAttributes] ( [ItemID] [int] NOT ...more >>

Create a system table
Posted by ECR at 7/9/2003 12:30:49 PM
How would I create a system table or stored procedure? ...more >>

UPDATE MULTIPLE ROWS IN ONE TABLE OBTAINING SUMS FROM ANOTHER TABLE
Posted by Jon Spartan at 7/9/2003 12:25:24 PM
UPDATE MULTIPLE ROWS IN ONE TABLE OBTAINING SUMS FROM ANOTHER TABLE I need to update a table with distinct sums from another table. I will obtain my sums from a table dspCDRv1 and the relevant fields in that table are BrandID, xCountryCode, CallDate, Duration. The Table I am going to upda...more >>

resource low - Transact-SQL
Posted by Otto Naesset at 7/9/2003 12:15:49 PM
While excuting a stored procedure in Query Analyzer I update a table over 2000 times. I have a commit after each record processed. At about row 2000 I box appears stating "Resource low, some results are dropped" What does this mean and what do I do to fix it? Thanks Otto...more >>

Scaling problems with SQL Server
Posted by Amol Kasbekar at 7/9/2003 12:02:06 PM
We have a process which one run by a only a single client takes 93 seconds. I run this test from query analyzer. The SQL Server is installed locally and is running on Quad processor each of 1.5ghz with hyperthreading. I next create 7 sessions in query analyzer and run this test concurrently f...more >>

Hexadecimal to Decimal conversion
Posted by news at 7/9/2003 12:00:32 PM
Hi ! There is any function in T_SQL to convert values in Hexadecimal to Decimal / Thx ...more >>

SQL Server 2000 SP3: Why is Table variable slower than temp tables?
Posted by FL at 7/9/2003 11:58:35 AM
Hello, Recently, I am trying to optimize some old stored procedures. In the process, I found out in the online help that a "table variable" is supposed to perform better than temp tables. However, I have found exactly the opposite. Whereas using temp tables, I can obtain query results in less...more >>

SQL subquery question
Posted by derek at 7/9/2003 11:34:58 AM
I have a query running inside of Coldfusion webpage. query blah cfoutput query blah { query another_blah { cfoutput another_blah { calculations } } } Problem: You cannot have nested cfoutputs. Is there a way in SQL to do those calcu...more >>

Can it have dependences without a relationship among the tables?
Posted by Frank Dulk at 7/9/2003 10:48:21 AM
Can it have dependences without a relationship among the tables? ...more >>

Look up Tables
Posted by Leon Shaw at 7/9/2003 10:30:53 AM
Do you relate look-up table in sql server 2000? Example: MEMBER TABLE STATE TABLE MemberID StateID State State Would you relate these two table if you only need the state table to serve as a drop down list of states to complime...more >>

Update Statement
Posted by TomR at 7/9/2003 10:22:55 AM
Can someone please give me a hand with this... Here is what I an trying to do. I have two tables (Table1 and table2) I want take the data from Table2 and replace the data (row) in table1 but only if field1 matches. It seems easy but I just cant get it. Thanks in advance for any help....more >>

emailing from trigger
Posted by Andrea Worley at 7/9/2003 10:09:06 AM
Does anybody have a suggestion for the best way to send email from a trigger? Is it even possible? I'd like to send a notification everytime a new entry goes into a table. Thank you....more >>

KB Articles
Posted by Sender at 7/9/2003 10:01:37 AM
Where can we find the index (list) of all the Microsoft KnowledgeBase Articles (KB Articles)on SQL Server 2000. Under the "Search Knowledge Base" link at the support.microsoft.com, we can search on the basis of KnowledgeBase Article ID or Keyword. But this only gives the KB Articles focus...more >>

Way out for Branch database
Posted by niitmalad at 7/9/2003 9:59:41 AM
Dear Friedns We have purchase a new office which is in another city and far away from our office. We want to make the same as our back-office or Branch but we want that all the users should use only one database. Please suggest what is the best way out to achive this target. your gu...more >>

SUM() for current week
Posted by Simon at 7/9/2003 9:57:13 AM
Hi, I have orderTable, where I have orders of products for each country. I would like to create a select statement, which returns the quantity of orders for the current month and current week. Something like that: SELECT SUM(quantity) as monthQuantity, SUM(quantity) as weekquantity FROM...more >>

communicate between xp_cmdexec and t-sql
Posted by Tommy at 7/9/2003 9:34:15 AM
i wanna delete some files in sqlserver jobs which files name are feteched from the database through t-sql store procs. ex: select 'pic'+picIdx as filename from PicData how do i manage to do that? ...more >>

JOINs in Views
Posted by Martin Lingl at 7/9/2003 9:02:52 AM
Hi group! I'd like to know the following: If I define a view that JOINs several tables, then query this view and only select a few of the columns so that not all tables are needed, will the JOIN still be done with all the tables? The point is, sometimes I only need a few columns (not always t...more >>

ORDER BY clause causes read-only recordset
Posted by Brian at 7/9/2003 8:42:51 AM
I have a website with some asp pages running off of a MS Sql db. For reasons that I can't explain, whenever querying the database with a SELECT query containing an order by clause, the returned recordset is read-only, regardless of cursor or lock type. This seems to be specific to the host...more >>

Way out for Back office
Posted by Niitmalad at 7/9/2003 7:39:36 AM
Dear Friends My company have started a new office in another City which will work as a backoffice for our comany. Hence we need that all the user of backoffice should work on the SQL database of our server. Or the data from both the end should remain update at any particular time. Ple...more >>

CREATE TRIGGER
Posted by Stephen at 7/9/2003 7:25:25 AM
Hi why do I get a syntax error near '[' for this trigger CREATE TRIGGER [t_fox_TIMERu] ON [dbo].[fox] FOR INSERT, UPDATE, DELETE AS DECLARE @foxtimer datetime SET @foxtimer = DATEADD ( hour , 5, (SELECT MAX(TIMER) FROM fox) ) INSERT INTO fox (TIMER, ADDRESS, EMPLOYEE, EMAIL, URL) VA...more >>

Select all the user table
Posted by hngo01 at 7/9/2003 7:01:44 AM
Hi, Is there a way to select all user tables? For example, I created 5 tables. In SQL analyer, I want to select table name and strutures of tables that I have created. Thanks ...more >>

list numbers in sequential order
Posted by Jane at 7/9/2003 6:55:54 AM
How can I make the new column to list number in sequential order based on the value from another column. In other words, I would like it to look like the following: column 1 new column -------- ---------- a 1 a 2 a 3 b 1 ...more >>

Stored Procedure Not Returning
Posted by Amanda Osment at 7/9/2003 6:51:01 AM
I have a stored procedure that calls another stored procedure. The second stored procedure will run and update the correct data - it just never returns and proceeds with the stored procedure that calls it. If I execute the stored procedure through Query Analyzer it will work correctly ever...more >>

Joining Tables from different DBs => Do I have to care about performance?
Posted by xmrf NO[at]SPAM yahoo.de at 7/9/2003 6:41:16 AM
Hi, I have a more theoretic question: I have two huge tables (db1.dbo.table1 and db2.dbo.table2). I need to join them. Will the effort to join both tables be the same as if both tables were located in the same database? Maybe it even performs better when I copy db1.dbo.table1 to db2 before ...more >>

Need Web-Based DB Record Editing Tool
Posted by hoochiegooch NO[at]SPAM hotmail.com at 7/9/2003 6:01:23 AM
Hi, all. Is anybody currently using a web-based tool to add/edit/delete records to SQL Server 2000 tables? I've been writing my own ADO.NET & ASP.NET code, but surely I don't have to do all this myself! I played around with a product named ASPRunner; they're exactly what I need to do, but...more >>

string formatting
Posted by Michael at 7/9/2003 12:52:38 AM
I need to convert a numeric filed NUMERIC(14,3) to a string with a (european) regional currency formatting like "1.234,56". How can I achieve this, please ?...more >>


DevelopmentNow Blog