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 > december 2003 > threads for monday december 22

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

WHERE clause: use "IN" or "=" or ?
Posted by J Belly at 12/22/2003 10:34:12 PM
Happy Holidays all: I have a simple problem -- I have a table that holds a listing of members' favorite colors. For example: MemberID FavoriteColors ----- ----- 1 Blue 1 Red 1 Green 2 Yellow 3...more >>


Query takes too long
Posted by Nesaar Banderker at 12/22/2003 9:40:25 PM
I have a sql script as shown below. This take about 9 hours to run. However, when i remove the "Link the duplicate entries that would have been missed since the grouping into #oxpsum" code (to the "Update linked rows to dbt_oxp_history" code) it takes about 23 minutes to run. If i then run the "...more >>

cast problem, I think
Posted by kloepper at 12/22/2003 7:31:05 PM
Hi: I'm having trouble casting...I think? I get the browser error...Syntax error converting datetime from character string. Below is the parameter from my ASP.NET code...the parameter comes from a dropdownlist control named Date and the value being used is entered as 12/20/2003, and is e...more >>

sql problem
Posted by rashmi at 12/22/2003 6:53:34 PM
I have a sql select * from categories where categoryid in (4,3) now sql server gives results as 3 categoryid categoryname 4 categoryid,categoryname but i want the resultset to be in the same order as the values in IN clause i.e. first record id with value 4 and then recordID with value 3 Th...more >>

Problem with RegOpenKeyEx Windows API when called from Stored Procedure
Posted by Aditya Sanghi at 12/22/2003 6:16:49 PM
Environment : Windows 2000 , VC7.0 , SQLServer 2000. hi all, I have made a COM component using VC 7.0. I am calling this component from a Stored Procedure in SQL Server database. Inside my component I am calling RegOpenKeyEx() API with the following code to access ODBC related information...more >>

Trigger issue
Posted by Mullin Yu at 12/22/2003 6:12:24 PM
I want to write a trigger that it will update the another table's 'status' column once the column 'status' of original table has been update. I wrote something like below. How can I know the value of - status_of_OutboundQueueItem - batch_id_of_just_updated_record ALTER TRIGGER tr_OutboundQ...more >>

Dynamically evaluate a formula?
Posted by Ian Smith at 12/22/2003 5:56:12 PM
I need a way to dynamically evaluate a formula in SQL. I've got a column that stores formulas for calculating the capacity of various RAID array levels, e.g. '(x * n) / 2' for RAID 1 and 'x * (n - 1)' for RAID 5, where x is the capacity of the smallest drive, and n is the number of drives. I need a ...more >>

How to transpose in Transact SQL
Posted by Victor at 12/22/2003 5:45:49 PM
Can someone help? I would like to tranpose the data from: Project ClassA ClassB ClassC 123 1 2 3 234 4 5 6 to the following: 123 234 ClassA 1 4 ClassB 2 5 ClassC 3 6 ...more >>



INNER Join Update fails in SQL Query analyzer, works in Access, Why!
Posted by Kevin at 12/22/2003 5:16:01 PM
This works in Microsoft Access but fails in SQL Query Analyzer, why! UPDATE ProgramReportingTable INNER JOIN ProjectBudget ON (ProgramReportingTable.BrCode = ProjectBudget.BrCode) SET ProgramReportingTable.BUDGETAMT = [Budget] cmd.CommandText = sSQL cmd.Execute I get this error: Incorr...more >>

Will a FOR UPDATE trigger fire on existing data?
Posted by G at 12/22/2003 5:05:51 PM
Hello I have a FOR UPDATE trigger that I want to put into production. Would I be correct in assuming that the trigger will only fire for new data that gets updated on the trigger's column? (i.e. the trigger will not fire because of any data that has been updated in the past on that column...more >>

Is it possible to have a foreign key constraint to a partial primary key?
Posted by Shan McArthur at 12/22/2003 5:03:53 PM
Hello, I have a table that has a column that refers to a part of a primary key in another table (the other part of the primary key is [Language]). The secondary table is a lookup table that is multilingual. I want to have some referential integrity on my first data table that ensures that a ...more >>

How do I multiply two stored proc values together??
Posted by Aaron Ackerman at 12/22/2003 4:53:40 PM
I have to stored procs that each bring back ONE single integer value. How do I bring these two return values together in another stored proc to perform a math operation on both of them? Thanks! ...more >>

Authenticating Users
Posted by milan c gurung at 12/22/2003 4:02:16 PM
Hi, I have created some users like John, Matt etc. All the users belong to Test Role. Now, my problem is, I have created a login form with UserName and Password fields. How can we authenticate the Database user using visual basic? Thanks, Milan ...more >>

SQL Database size increases after importing data from VFP
Posted by ranil at 12/22/2003 3:48:15 PM
Hi all, I have a Visual Fox Pro database from which I import data into a SQL Server database via ODBC drivers. Both VFP & SQL Server databases have the same schema except for the fact that of certain fields the data type is different. ex: In VFP tables I have MEMO feilds but on SQL Server ta...more >>

question on stored procedure performance
Posted by David Zeng at 12/22/2003 3:47:29 PM
Hi, all, Are there anyone find the performance differences between runing sql codes and runing codes as a stored procedure? It looks like compiling codes is different to compiling stored procedures in SQL Server or stored procedure is handled completely differently. The below is my experience,...more >>

Find a character in a table
Posted by Hlin at 12/22/2003 3:45:17 PM
Hi all I need create a view. Original field like this: Abcdb / assdfas fasdfasd / dsfasfd rtywert / ds 1256 / 5df My view needs all the records from that field but nothing after "/". I need as following: Abcdb fasdfasd rtywert 1256 ANy ideas? Thanks ...more >>

List of connections
Posted by Jonas Mandhal Pedersen at 12/22/2003 3:45:11 PM
How can i retrieve a list of current connections to the database, using transaction SQL ? Jonas ...more >>

Help with extracting records
Posted by George Fernett at 12/22/2003 3:15:39 PM
Hi all, I am having a very hard time coming up with the correct syntax to return the needed records. The table has two fields: and ID filed (alpha) and a CODE field (alpha) There are multiple records for each ID since each ID can be associated with multiple codes. If given two or more ...more >>

Returning value of COMPUTE as OUTPUT parameter
Posted by John Sitka at 12/22/2003 2:56:06 PM
???? Other methods to derive the same value as returned by COMPUTE work but each has shown a perf penalty. Can Returning value of COMPUTE as OUTPUT parameter be accomplished. Merry Thanksmas ...more >>

Detecting what version of Windows SQL Server is running on
Posted by Gary Hampson at 12/22/2003 2:39:06 PM
Hey guys... How can you determine what version of the OS is installed on your SQL Server programatically? I am setting up a centralized metadata database for all the SQL Servers in our enterprise and really need to know how to differentiate between Windows 2000 Server and Windows 2000 Advanc...more >>

SQL Query
Posted by J P Singh at 12/22/2003 2:31:50 PM
Hi All This is a bit tricky and I have tried everything I could. Please help |I have a two table database. EmployeeProfile EmployeeNumber FirstName LastName HolidayRequests table which holds the data for the holidays that our employees have booked. Structure EmployeeNumber D...more >>

SQL Server Domain Account
Posted by Ken at 12/22/2003 2:21:21 PM
We currently have SQL server running on a local system account. I am submitting paperwork (figures) to have it run on a domain account so that we can, among other things, enable SQL Mail. When we make this change, is it going to affect how the SQL Server is visible to the network or to programs wr...more >>

I must be blind!
Posted by Sydney Lotterby at 12/22/2003 2:00:06 PM
(SQL2K w/sp3a) Trying to stuff all notes from 'm' into 'i' for matching vpid Second script runs but i.Notes is still null at the end. Must be missing something - but can't see it. I've written a cursor to do it but it takes forever even though both tables are indexed on vpid --zap all i.note...more >>

Date diff confusion
Posted by laurel at 12/22/2003 1:52:47 PM
Select DATEDIFF(year,'1974-09-25','2003-09-28')=29 Select DATEDIFF(year,'1974-09-25','2003-09-18')=29 Can someone explain that to me? Laurel...more >>

SQL Script question
Posted by Ed at 12/22/2003 1:51:11 PM
I am very new to the programmability with SQL. I am needing to develop a script which would translate the data I am looking at exporting data from one table and importing or populating a differn't application with the data and need to translate the values I guess in a nutshell I am trying to put...more >>

What command to run sql scripts from a master script ?
Posted by james at 12/22/2003 1:28:40 PM
I have several scripts I'd like to run from a master script like so run_script "c:\MyScrips\sc1.sql" run_script "c:\MyScripts\sc2.sql" What is the proper command ? (Assume i am running from QueryAnalyzer) thanks, JIM ...more >>

SQL Query Search
Posted by Surjit Madiwalar at 12/22/2003 1:03:00 PM
Hi, I am developing Intranet Application.Presently I am implementing search feature I have table tb1 with fields as fld1,fld2,fld3 & fld4. All fields are varchar type Now i need search keyword(s) from fld1,fld2,fld3 Condition is either "Using OR" or "Using AND" User is going to ent...more >>

query parsing
Posted by mahak at 12/22/2003 12:10:06 PM
select object_name(id), * from syscomments where text like '%create table%' I want to also grab test like create table create table create table create table how can we do this. TIA ...more >>

Insufficient Key Column Information
Posted by Gerard at 12/22/2003 11:54:46 AM
I can't find this, I obviously dont know enough about T- SQL. All I am doing is updating some values to the recordset. When an ADO recordset is trying to use the .UPDATE method, or .Refresh, it bombs out saying; "Insufficient Key Column Information for updating or refreshing : -2147467254 ...more >>

Query Help: would like to avoid the use of a cursor
Posted by William Morris at 12/22/2003 11:34:14 AM
I've read countless times in this newsgroup that cursors should be avoided, and that most things can be accomplished without using one. Okay, I'm good with that theoretically; need some advice, then. I would like to return the results of a query as a single string returned in one column of a...more >>

Dynamic Order By Clause
Posted by dw at 12/22/2003 11:14:37 AM
Hello all. We need to create a dynamic ORDER BY clause for the SELECT statement, and then also add DESC to the clause. That's the part that's got us stuck. How do we get it to be DESC? Here's the clause we've got already, but it doesn't seem to be returning items in descending order, ....... (C...more >>

DTS Update
Posted by Vad at 12/22/2003 11:10:53 AM
Hi, Is there a way to do an update in DTS when you importing data from Excel file? Thanks a lot, Ivan ...more >>

Updating a text field in SQL Server 2000
Posted by Michael Walton at 12/22/2003 11:10:34 AM
I am trying to write some ASP code that inserts or updates a text field in my SQL Server 2000 database. The SQL statement is created using a submit from a form, and the text is coming from a <textarea>, and therefore being placed into the SQL statement via a Request("field"). However, due to l...more >>

slow recordset with 500k items!
Posted by Lars Grøtteland at 12/22/2003 10:47:56 AM
Hello! Having one SP that return 500k items, and I was wondering how I Can speed it up. It takes a minute to execute, and if two users should do the same thing - I receive up to three minutes to execute each query. How can I speed it up, or can I use the top 50000 and use this 10 times? ANy he...more >>

Is it possible to rollback to a certian time by using the log files
Posted by pg8290 NO[at]SPAM yahoo.com at 12/22/2003 10:42:35 AM
Is it possible to programmatically roll back committed transactions to a certain datetime. What would be some good resources to help me be able to accomplish this? TIA, Peter G....more >>

OT:Newbie:Identity
Posted by James Barrett at 12/22/2003 10:31:06 AM
Hi & TIA, I am trying to navigate a large migration into SQL Server as a new SQL Server DBA. We are using ADO to import the data instead of DTS. The project is going well but cruch time has approached and we are trying to get the last of it done fast. Here's the problem at hand: I dropped...more >>

return Nothing from SP
Posted by simon at 12/22/2003 10:06:53 AM
I have SP and if I execute it I get nothing. If I put the same code in sql query analyzer and execute it from there, I get one row as a result set. What that could be? ...more >>

Searching VarChar Columns
Posted by SFRATTURA at 12/22/2003 9:24:59 AM
Here is an example of a record i would search: datetype VarChar(255) "sexy single female, non-smoker, into hiking, rollerblading and most outdoor activities. Seeking handsome single man for fun and friendship first, romance later" I want to search that text for ANY of a series words: ...more >>

How to convert SQL99 OLAP functions to T-SQL...
Posted by John Kane at 12/22/2003 9:24:05 AM
Hi all, I need to convert the below SQL99 OLAP code fragment to T-SQL: -- code fragment: SUM(CASE WHEN c.Par IS NULL THEN 1 END) OVER (PARTITION BY a.ID ORDER BY a.ID, b.Index ROWS UNBOUNDED PRECEDING) AS Number FROM Temp a CROSS JOIN Index b LEFT OUTER JOIN Par c ON Parsed = c.Par QUALIF...more >>

sp_depends
Posted by mahak at 12/22/2003 9:17:45 AM
when we create a table under a sp, sp_depends does not recognize this, how to get all those tables which have been created under a db using procedures. e.g. create proc p1 as begin create table t1 (name char(10)) end ...more >>

SP to Access report
Posted by Url Onz at 12/22/2003 9:16:04 AM
I got it! I was able to pass the parameter for the proc to the report RecordSource via a Form by putting the code in the Reports module. It looks like this: Private Sub Report_Open(Cancel As Integer) Dim cn As String cn = Forms!frmOlderCaseJobOffer!txtCN.Text Me.RecordSource = ...more >>

advantage of binary collation?
Posted by John Livermore at 12/22/2003 8:51:39 AM
When installing SQL Server 2K you are given the option to choose a collation. Someone told me that binary was the best choice as it is the most performant when you compare string data. That is about all I know on the subject. Can someone make a recommendation as to whether we should just cho...more >>

xp_regread error
Posted by lcw at 12/22/2003 8:46:19 AM
When executing this procedure I get a connection broken error. I am using the eval copy on windows 2000 single PC. declare @chvsqlpath varchar(255) exec master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\MSSQLServer\Setup', 'SQLPath',@chvSQLPath OUTPUT select @chvSQLPath SQLPa...more >>

SQL Programming
Posted by Kim at 12/22/2003 8:26:14 AM
I have written a query to display answers from my survey. Is there a way to have my output come out as Question 1 Count Answer Subquestion Choice A 1 Choi...more >>

Access -> SQL Server replication.
Posted by Rolls at 12/22/2003 7:39:53 AM
Hi. I'm new to the group and have been reading through a few posts. Thought I would pass along a "tip" developed by my Houston user group. We have developed a technique for assigning a unique ID number to every item in an Access database, replacing the use of autonumber. When a new row is ad...more >>

Insufficient Key Column Information
Posted by Gerard at 12/22/2003 7:20:34 AM
I can't find this, I obviously dont know enough about T- SQL. All I am doing is updating some values to the recordset. When an ADO recordset is trying to use the .UPDATE method, or .Refresh, it bombs out saying; "Insufficient Key Column Information for updating or refreshing : -2147467254 ...more >>

Alter a view from and SP
Posted by Url Onz at 12/22/2003 6:57:07 AM
I have a database where all the users with the exception of about 4 managers are allowed to see only there own data. My users including the managers do not have the skill to do more than enter data and click buttons for reports. The data base has Access adp front ends. There is a report ...more >>

Profiler
Posted by Jim Heavey at 12/22/2003 5:16:28 AM
I am trying to learn how to use the profiler. I created a profile which filters a single table. I selected all of the data columns in order to see what is actually brought back when I run a "select only" procedure from a remote client. I also selected all events except security audit and ...more >>

Strange thing, one comment cause huge difference on performance
Posted by david at 12/22/2003 2:18:04 AM
I have a query, I found if I run this select top 2 fieldtag=1,r.id,linkid=l.h2rid,firstname=r.firstname,lastname=r.lastname,onl ine=r.online,'hide'=dbo.uGetAttribute3(l.type,l.attribute,'hide'),'lock'=dbo ..uGetAttribute3(l.type,l.attribute,'lock'),'usertype'=dbo.uGetAttribute3(l.t ype,l.attr...more >>

Cannot open database 'databasename' version 534 or 536
Posted by Abdhul Saleem at 12/22/2003 12:01:08 AM
Hi, I have 3 database backups created from sql7. I have to restore them in sql2000. Then I have to create a sql login and attach it to the databases as users with dbo role. For restoring the dbs I used "restore database with move" statement and executed using ADO. Then to create the sql logi...more >>


DevelopmentNow Blog