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 > june 2007 > threads for wednesday june 27

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

compute and ado
Posted by js NO[at]SPAM someone.com at 6/27/2007 11:02:37 PM
Hi, I'm using ado recordset to get a store procedure's dataset. how to process the compute result. how to get the sum field? Thanks. SELECT ProductID, SalesOrderID, OrderQty FROM SalesOrderDetail WHERE SalesOrderID > 43650 ORDER BY ProductID, SalesOrderID COMPUTE SUM(OrderQty) By ProductID ...more >>

Return Check Constraint Values
Posted by Toyist at 6/27/2007 11:02:23 PM
How can I return the values in a column check constraint? create rule R_ListOfValues as @column in ('value1','value2','value3') go execute sp_addtype ListOfValues, 'char(6)' go execute sp_bindrule R_ListOfValues, ListOfValues go create table Table1 ( ListItem Li...more >>

ResultSet naming
Posted by at 6/27/2007 10:33:48 PM
is there a way to identify/name the resultsets in a SQL select query such as; select * from table1; select * from table2; so that the resulting DataTables in the DataSet already have the TableNames set, instead of just having the default names such as Table1, Table2 something that might lo...more >>

Fatal EXCEPTION_ACCESS_VIOLATION when running SQL 2000 query
Posted by ghyotsesso NO[at]SPAM kriocoudek.mailexpire.com at 6/27/2007 10:09:17 PM
Hi, I'm receiving the following exception: -- SqlDumpExceptionHandler: Process generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. -- When I attempt to run the following query through Query Analyzer: -- Select * From ReportContractHistor...more >>

Rename Table Name to Uppercase
Posted by Joe K. at 6/27/2007 8:38:00 PM
I am searching for a T-SQL script that will update all user tables to uppercase names. Table Name example: Before After amtcp AMTCP Please help me complete this task. Thanks, ...more >>

Sorting with CASE
Posted by scott at 6/27/2007 7:12:54 PM
In CODE1 below, I'm trying to use a CASE statement in an ORDER BY clause. If I set my @iSort variable equal to '3', my sql runs fine because the ipTypeID field is of INT type. However, if I set @iSort to 1 or 2, I get an error saying "Syntax error converting the varchar value '192.168.1...more >>

The Nested Set Model example error on ORDER BY clause
Posted by alun65 NO[at]SPAM gmail.com at 6/27/2007 6:56:20 PM
I'm attempting to use the The Nested Set Model to store a treeview in sql server 2005. I found a great arterial here for mySQL: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html I'm new to sql server and I'm having alittle difficultly re-creating one of the examples. Bascica...more >>

Add column to "Group By"
Posted by Hulicat at 6/27/2007 5:46:40 PM
I need to group by an addditonal field named: problem_type_name in the Problem_type table which is tied to the job_ticket.problem_type_id This worked in the other query I used and then added in the "group by" INNER JOIN problem_type p ON (p.problem_type_id = j.problem_type_id) Here is t...more >>



convert UTC field to local time
Posted by at 6/27/2007 5:17:10 PM
I have a field in a table that stores the UTC date formate as a string. I need to convert this to local time. How can I do this. I am using SQL Server Express and I am very new to sql server. Thanks for your help. ...more >>

Ranking & top N for multiple groups
Posted by Bill Nguyen at 6/27/2007 3:48:33 PM
I need to obtain a reseult set showing price ranking (from lowest to highest) for each tankID so that I can pick the top 5 best price for each tankID. My database is still SQL 2K, not 2005. Thanks Bill --------------- TankID TerminalID Price PriceRank ...more >>

Query Help
Posted by Bruce Schwartz at 6/27/2007 3:04:44 PM
Hi all. We have a table of categories and a table of products. I want to find one (1) category that has less than 50 products, (preferably the category with the most products less than 50). Table Categories CategoryID CategoryName Table Products ProductID fkCategoryID ProductName ...more >>

TSEQUAL is not working properly in SQL Server 2005?
Posted by Linda at 6/27/2007 2:46:01 PM
Hi, I was running sql update from Powerbuilder application with: UPDATE Name SET Name = 'John Dole', UpdatedUserId = 3, UpdatedDate = getdate() WHERE NameId = 785 AND tsequal(timestamp, 0x000000001D46DDDA) I got the following erro message: Incorrect syntax near 'TSEQUAL'...more >>

statement to determine if record exists?
Posted by Jerry N at 6/27/2007 2:06:45 PM
I would like to determine if the a record exists using a SQL statement (only found example using stored proc). How do I write this code as a valid SQL statement? if exists (select null from contact where LastName = 'Anderson') I've tried a few things like: select ___ from ___ where not...more >>

query instead of cursor
Posted by cris at 6/27/2007 1:58:01 PM
hello, i can do this with a cursor but i'm pretty sure it can be done with a query instead. i have 2 tables, the first contains ranges. table1 range_id range_start range_end 1 1 17 2 18 25 3 26 ...more >>

Using aggregate fields in a WHERE or HAVING clause
Posted by RSH at 6/27/2007 1:49:18 PM
Hi, I have a simple aggregate query that uses an alias field name (3 actually). My problem is I want to remove all of the rows from the resultset that don't have a value > 0 in any of the columns (one of the three columns must contain a value > 0) How do i add that filter to the Where cl...more >>

Excessive Compile Times in SQL Server 2005 SP2
Posted by EGMIII at 6/27/2007 12:43:46 PM
I've been trying to figure out why a query takes over 80 seconds to compile. I've written vastly more complex statements that compile in far less time. Any thoughts on how to debug this? I've searched the web for hours with little help. I'm only using about 8 distinct tables. The query has 4 lev...more >>

SQL MAIL - 64 Bit
Posted by Nitin at 6/27/2007 12:26:02 PM
SQL Mail is not supported in SQL 2005, 64 bit release. What do people use to send email notifications from SQL Server? Environment: Windows - 2003 64 Bit SQL - 2005 64 bit One more thing to add is this is a clustered environment. Thanks in advnace...more >>

BOL statement was removed about Partitioned Views // Anybody know why it was removed?
Posted by sloan at 6/27/2007 12:19:04 PM
At one time, BOL had this statement: "local partitioned views are included only for backward compatibility and are in the process of being deprecated." http://technet.microsoft.com/en-us/library/ms188250.aspx However, the statement was ~removed~ from later BOL versions. (As the url ...more >>

Search Functionality Dilemma in SQL
Posted by Nightcrawler at 6/27/2007 11:09:07 AM
I have the following stored procedure that I use for search SELECT * FROM Table WHERE Name= @Name AND Email = @Email AND CountryId = @CountryId AND StateId = @StateId The problem is that I don't know what parameters will be supplied since it is up to the end user to suply search param...more >>

Got paging ideas for SQL 2000 ?
Posted by at 6/27/2007 10:12:31 AM
Can anyone come up with a faster way to copy/transform records from one database to another? Is there a faster way than using cursors. Lately a run of this on 50 million records took 6 hours. -- Populate observations table SET NOCOUNT ON --declare cursor DECLARE cc CURSOR FOR SELECT ...more >>

programming the CLR
Posted by PamelaFoxcroft at 6/27/2007 9:09:02 AM
I have an external dot net assembly. I want to call some of its functions within a SQL CLR UDF I am writing. I can't reference this assembly in the Add Reference menu item. How can I do this? ...more >>

How to tell when a Row was Inserted into a table?
Posted by Ryan at 6/27/2007 7:57:05 AM
Generally for most of my tables I have a custom field (AddedTime) that I set to the current time whenever a row is INSERT'ed. Is there a way to find out when a row was added for tables that I do not have this custom field? Thanks, Ryan ...more >>

Loading date data
Posted by Rob at 6/27/2007 7:24:03 AM
I receive a fixed length file that contains a date value as in: 14060, which translates to: Jun 14, 2007. I bulk insert this file using a format file (shown below) to a date column in a table: ::::::::::::::: 5 SQLCHAR 0 06 "" 5 ActivityDate SQL_Latin1_General_Cp1_CI_AS ::::::::::::::: ...more >>

Update Trigger batch processing
Posted by Liz at 6/27/2007 5:52:01 AM
SQLVersion: SQL 2000 sp4 Trigger code: alter TRIGGER [dbo].[trg_updtbcbsalmonthlyeligibility] ON [dbo].[MonthlyEligibilityBCBS] FOR UPDATE AS BEGIN UPDATE ME SET UpdateDT = GETDATE() from [dbo].[MonthlyEligibilityBCBS] me join inserted i on me.pkey = i.pkey END TSQL statement: ...more >>

How to import/export data by an application
Posted by AliRezaGoogle at 6/27/2007 5:46:22 AM
Dear memebers, Hi. I have designed an application to archiving a large database. I have also designed a DTS in sqlserver 2000.But my problem is how to call the DTS plan from sqlserver. Is there any solution. Also : Is there any SQL command to import or export data. Regards ...more >>

Query Help!
Posted by Jami at 6/27/2007 3:42:08 AM
Dear All! i m using following query to get a result it is giving me result of all records which are matched although i m using left join how should i change the query that all list is displayed SELECT c.Region_Description as Region, count(*) Total, count(b.id) as receiv...more >>

T-SQL to emulate crosstab output
Posted by Steve at 6/27/2007 3:40:32 AM
Hi I want a query that normally outputs:- DBName Evenet Date ======= ===== ==== dbname1 event1 date dbname1 event2 date dbname1 event3 date dbname2 event1 date dbname3 event1 date dbname3 event3 date dbname4 event2 date using: SELECT dbname, event, date FROM table1, table2 WHERE ...more >>

sp_send_dbmail error Msg 15404
Posted by Roberto Kohler at 6/27/2007 12:12:24 AM
Whenever sp_send_dbmail uses an @query it fails with Msg 15404, Level 16, State 19, Server [ServerName], Line 1 Could not obtain information about Windows NT group/user [domain account], error code 0x5. e.g. EXEC msdb..sp_send_dbmail @subject = 'test', @recipients = '[email address]'...more >>

date range problem...
Posted by trint at 6/27/2007 12:00:00 AM
Here is my current query: select id, order_date, shipping_firstname, shipping_lastname, total_charge, completion_status from orders Where order_date <= '20070627' And order_date >= '20070601' and completion_status <> '0' ORDER BY id desc The problem is that 20070627 is not included in the...more >>

Server: Msg 916, Level 14, State 1
Posted by Paul at 6/27/2007 12:00:00 AM
I Have a linked server linking from a 2000 to a 2005 server. The connection seems to be working but the view I have had created gives the following error when I try to pull data. The problem would seem to be on the distant server as I have tried this on 2 different local servers. One odd th...more >>


DevelopmentNow Blog