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 2003 > threads for monday august 4

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

Question about storing "date modified"
Posted by Westside at 8/4/2003 11:06:36 PM
Hi, In our application, we want to store the data a record was modified. Would it be appropriate to use the "Timestamp" datatype? If not, which would be appropriate. For example, if a user updates his/her profile, we wanted to store the data modified.. WestSide... .. *** Sent v...more >>

how to resolve duplicate record issue?
Posted by jungewum NO[at]SPAM yahoo.com.au at 8/4/2003 10:10:32 PM
I would like to insert into Student table from another database (as follows). The problem is I encounter duplicate key (primary key is student_id) error when inserting the record. How do I change this to perform insert if record not exist, perform update if record exist? insert into Student ...more >>

Crosstab View Help
Posted by Alastair MacFarlane at 8/4/2003 9:56:34 PM
Dear all, I am trying to create a View, which will summarise the data in one table called tblPatients. The important fields are Sex (char(5)), Weightkgs (smallint) and DateAdded (smalldatetime - default getdate()). I would like to create a view which summarises the date as follows: Sex: Ma...more >>

converting an Access Query
Posted by Kevin NO[at]SPAM 3NF at 8/4/2003 9:46:05 PM
I have a query that needs converting to a stored procedure...goes something like this: Select field1, field2, field1 + field 2 as field3, field3 + 5 as field4, field4 + 492 as field 5....etc. There are about 6 actual fields, and a number of fields that are calculated ...more >>

Need help Now
Posted by Troy at 8/4/2003 8:56:19 PM
I need someone to answer a few questions that I have. Nobody seems to want to help me on the other newsgroup. Can you please answer a few SQL questions? Here are the questions: 1. Say you have a drop down list based on a SQL statement, want limited by the values in another control on th...more >>

SQL Server Trigger Question
Posted by tommynospam NO[at]SPAM yahoo.com at 8/4/2003 8:32:09 PM
Tryin' to do something relatively simple but I'm just drawing a blank. Before an INSERT takes place, I want to check another table. The other table must have the primary key already existing AND one other field must be NOT NULL. If either of these fails, I want to stop the INSERT. I know ...more >>

View does not use a proper index
Posted by Kenneth Choe at 8/4/2003 6:28:11 PM
<< Situation >> There is a view like this: create view v_test(PK_x, x1, x2, commonValue) as select PK_A, fieldA1, fieldA2, commonValueFromA from table_A union all select PK_B, fieldB1, fieldB2, commonValueFromB from table_B union all select PK_C, fieldC1, fieldC2, commonValueFromC from tabl...more >>

Creating an autonumber query
Posted by Andre at 8/4/2003 5:07:11 PM
I need a query that will insert an autonumber into a table. I haven't developed the table structure yet because I don't know which datatype to use. I have been trying with a varchar. Let me give an example of what I need the autonumber field to look like. Field 1 ------- 001 002 003...more >>



Have all the relationships of a Two tables in a resultset
Posted by Daniel Jorge at 8/4/2003 4:02:17 PM
Hi there, Well, what I want should be Quite simple, but I'm having quite of a = Hard Time to complete this task. Let's Say I have the following tables.. ID_Order and Customer_Name are Primary Keys in Both Tables, but = they're also FK in the Order_Items table -- ***************...more >>

sort is kinda weird
Posted by middletree at 8/4/2003 3:40:09 PM
I am not a DBA< so forgive me is this is too easy, but it's not easy for me. Doing ASP, I run this query to build a dropdown list (also known as a <select> box): SELECT EmployeeID, FirstName + ' ' + Lastname FROM Employee ORDER BY FirstName It gives me a long list, most of which is displa...more >>

SELECT syntax problem
Posted by muhamad kassem at 8/4/2003 3:35:07 PM
hi i have this query SELECT * FROM CUSTOMER i want to get the rows between 5-15 in example any one cane help me to solve this problem ...more >>

compatablity
Posted by ozcan at 8/4/2003 3:11:34 PM
Hi, Can you someone tell me if SQL Server 7.0 can talked to SQL Server 2000 and vice versa. Thanks...more >>

relation between tables of different db
Posted by Prashanth at 8/4/2003 2:49:45 PM
Hi! Is it possible to maintain a relation between two tables of two different databases. can you use triggers to check if the integrity holds or not. by replication you can maintain the relation. Is there any other way??? Thanx ...more >>

Passing input variables to stored procedures
Posted by Ed at 8/4/2003 2:34:19 PM
I have a SP (Stored Procedure) that pulls several columns from a single table. The rows returned are determined by the input variable of the SP. The WHERE clause is used to determine which rows to includes by using IN(x) where X is the primary key value of the row and x is the value passed t...more >>

a question about procedure cache flushing ...
Posted by randyv at 8/4/2003 1:59:10 PM
Howdy - I'm trying to 'map' my knowledge of Teradata to SQL Server - sometimes a worthwhile exercise, others not. My question is about performance of stored procedures. Is it a valid assumption that the procedure cache holds the parsing engine's plan for the SQL in the procedure? If s...more >>

Q: retrieving default values for parameters in stored procedures ?
Posted by Fridthjof-G Eriksen at 8/4/2003 1:47:20 PM
Hi, just wondered if anyone here knows a way to programtically retrieve the default values (if any) of the parameters of a given proc ? Tool to retrieve is not mportant (SQLDMO, SQL, ADOX, etc). Example: create proc proc_test @param1 int, @param2 int = 3, @param3 int out as begin s...more >>

Accessing a stored procedure from a view
Posted by Jeff Friedman at 8/4/2003 1:35:07 PM
What do I need to do to access data from a stored procedure within a view? Let's say I want to join information from one table, to information derived in a view. -jeff...more >>

SET IDENTITY_INSERT
Posted by Jezabel IsaĆ­as Angel at 8/4/2003 1:10:33 PM
Hi!, I have a table with an identity column, in some special proceses is requested to disable the identity option using SET IDENTITY_INSERT ON/OFF. Is there a way to give to a certain user the posibility to execute SET IDENTITY_INSERT without giving all the permissions of ALTER/DROP/CREATE a ...more >>

How to move .mdf file to another drive.
Posted by Sender at 8/4/2003 12:16:24 PM
I want to move my .mdf file from one drive (E:) to another drive (C:). Can I do it without backup/restore? WHat are the steps? ...more >>

Installation mistake SQL SERVER 2000?
Posted by Frank Dulk at 8/4/2003 11:51:08 AM
I bought a book for study For the first time I installed SQL Server 2000 Entreprise Editon. In the book it consists the information " Remembers that, for if conetar to SQL Server, a password will be demanded. The password standard of the healthy user is in white. In that installation " scre...more >>

Embarrassing! but how to find earliest sales record per customer?
Posted by Martyn Matthews at 8/4/2003 11:36:27 AM
Each customer has one or more sales records, and each sales record has a date. I need SQL to deliver one sales record per customer, choosing only the earliest-dated record for each customer. Have tried various combinations of GROUP BY, HAVING, TOP, subqueries etc - it seems so damn simple, ...more >>

SELECT STATEMENT and CALCULATIONS
Posted by Stephen McCormack at 8/4/2003 11:28:11 AM
Hi, I would like to know how I do a calculation in SQL if one of the values I am retrieving can equal NULL. See below: --------------------------------------------------------------------- SELECT TotalPrice = SUM(sc.quantity * p.retailPrice) --TotalPrice = SUM(sc.quantity * p.retai...more >>

Question about Top n
Posted by M Smith at 8/4/2003 11:20:11 AM
I am trying to generate a query that will give me a top 5 report of calls anwered by our drivers. It almost works, it does give me the top 5 the problem is that there really should be 7. The bottom 4 records all have 35 as their number but only 2 show up. Is there a way to get all there record...more >>

Reindexing Stored Procedures
Posted by Dave at 8/4/2003 11:17:46 AM
I got some SP's from a book called "The Guru's Guide to T-SQL" and I get this error: Executed as user: myserver\Administrator. Incorrect syntax near the keyword 'and'. [SQLSTATE 42000] (Error 156) Associated statement is not prepared [SQLSTATE HY007] (Error 0) Incorrect syntax near the key...more >>

more description of why i need bulk insert command for vb?
Posted by Trint Smith at 8/4/2003 10:57:43 AM
ok, i have these files needing to go into these tables in sql server 2000: Program.txt = TBL_Client BatchGroup.txt = TBL_Group Catalog.txt = TBL_Catalog Item.txt = TBL_MasterItem ItemSold.txt = TBL_ItemsSold Seller.txt = TBL_Seller they will always have the same format...something lik...more >>

SELECT statement
Posted by Simon at 8/4/2003 10:47:24 AM
I have 2 tables: orders and orderProduct: Orders: orderId status orderProduct: orderId productId quantity date Now I must select the latest quantity of product, if status of order is 2 or the second latest quantity of product if the status of order is 3. For example: ...more >>

UDFs with default parameters - doesn't work?
Posted by JXStern at 8/4/2003 10:44:45 AM
I seem to be able to use the default parameter syntax in declaring a UDF, but when I call it from the Query Analyzer, it still requires the optional parameter! >CREATE FUNCTION strClean > (@tx as varchar(255), @nLen as int = 0) > RETURNS varchar(255) AS >BEGIN > return (@tx) >END ...more >>

To Use Update Cursor or something else
Posted by Colin Colin at 8/4/2003 10:15:40 AM
I am rewriting some code that I want to run in stored procedures. The gist is to cycle through a work table and update several fields for each record based upon what is determined by other fields. (There is only about 10 fields in my table) I don't know alot about cursors. But should I use ...more >>

Scheduled Job Failed
Posted by solex at 8/4/2003 10:15:21 AM
Hello, I have scheduled the attached sql script to run in the SQL Server Agent. I have tried twice so far and get the following error message: "The job failed. The Job was invoked by Schedule 175 (Sunday). The last step to run was step 1 (Perform Email). NOTE: Failed to notify 'Chuck Ki...more >>

"IF" statement and views
Posted by Jeff Friedman at 8/4/2003 9:43:08 AM
Is it possible to use an if statement in a view? example of what I would like to do: select contribid, sum(iif(contribtype = 'mon', amt, 0) as moncontrib, sum(iid(contribtype = 'prd', amt, 0) as prdcontrib from hcontrib IIF does not seem to work when I am generating the view. Any sug...more >>

Cross-database - select/inserts
Posted by Mike Davies at 8/4/2003 9:14:55 AM
Hi, Can someone please provide an example of inserting into a table from a table in another database. i.e. use dbName1 go insert into Table1 select * from dbName2.Table1 Thanks Mike ...more >>

using parameters in an order by clause in a stored procedure...
Posted by randyv at 8/4/2003 8:41:24 AM
Hello all - I'm wondering, is it possible to create a stored procedure that would allow me to customize the order by clause with each run? Example: Table = EMP Columns = Last First Sex ...more >>

Trigger problem!! New transaction cannot enlist.....
Posted by Mike at 8/4/2003 8:40:04 AM
I have two window 2003 servers machines, each one has sql 2000 server installed in it. BOTH servers are on same domain!! I have a trigger on SERVERB, so that everytimes something get updated/deleted/inserted on manager table, it will fire the trigger and delete same thing from ma...more >>

bulk insert command for vb?
Posted by Trint Smith at 8/4/2003 7:44:33 AM
the bulk insert command looks like it would only work in a c program...is there a vb.net version? thanks, trint Net programmer trintsmith@hotmail.com *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!...more >>

sql server copying databasese from 7.0 to 2k
Posted by lara31 at 8/4/2003 7:41:33 AM
i currenntly have sql server7.0 and sqlserver2000 on two different boxes. The sql server is a more controled environment and i have been asked to move databases from sql server7.0 to the 2ksqlserver. the 7.0 databases are being accessed by several webapps and a windowbased application....more >>

Server 2000 Crosstab Query
Posted by Alastair MacFarlane at 8/4/2003 6:56:51 AM
Dear All, I am an Access designer more used to designing Crosstab queries with the syntax TRANSFORM...PIVOT, however when I look at SQL Server BOL, there is little mention of TRANSFORM as the T-SQL for creating Crosstab views. Can someone advise me of the syntax I should be looking at ...more >>

BUG: wrong week number for Dec 29, 2003
Posted by Harry at 8/4/2003 6:23:26 AM
The bug described by KB Article 200299 seems to apply to SQL Server 2000 as well. Here is how to reproduce: set datefirst 1 select datename(ww,'29 dec 2003') returns 53 instead of 52. I would like to know how to make sure this gets fixed asap. Apparently MS is only working on a fix for...more >>

text columns and sp_xml_preparedocument
Posted by Richard at 8/4/2003 4:11:13 AM
I have a table with a column of type text storing xml documents. I need to pass the contents of this column to stored proc sp_xml_preparedocument, all coding in Transact- SQL. Anyone know how to do this, bearing in mind you can't declare locals of type text? (I don't want to have to do mani...more >>

creating relationships
Posted by (deanpaddock NO[at]SPAM hotmail.com) at 8/4/2003 3:55:05 AM
im having difficulty creating multiple relationships between tables. i have a main table Name PROJECTS: COLUMN DATA TYPE ----------------------- project_id int(IDENTITY) Primary Key skill_1 varchar(50) skill_2 varchar(50) skill_3 varchar(50) skill_4 varc...more >>

BIG5
Posted by JKH at 8/4/2003 3:54:34 AM
Hi, I got a problem with BIG5. I want to send out an INSERT statement containing chinese character ( BIG5 ) via API to SQL Server database ( chinese version ). so, take a simple example, create table table1 ( c1 char(6) ); INSERT into Table1 values ( '<variable>' ); If the vari...more >>

Estimate CPU for a query
Posted by art_hur NO[at]SPAM wanadoo.nl at 8/4/2003 3:12:28 AM
The users of the application I work on want to be able to perform queries for themselves. For me that is ok, as long as there is no performance-loss for other users. Is there a way to predict the CPU-time the query will take in Sql-Server 2000? I know that with the option "set showplan_all on" I...more >>

Execution of a Stored_procedure
Posted by Ilenia at 8/4/2003 2:38:21 AM
Hello!!! I have a problem with this stored_procedure: I declared some variables in my SP and I made a select that returns some data of a certain activity as for example her name. The select is the following: SELECT @strBody = dbo.fn_BodyMail(IDActivity,ISNULL (Activity,''''),ISNULL (Desc...more >>


DevelopmentNow Blog