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 > october 2005 > threads for wednesday october 12

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

Please help with 'distinct'
Posted by Aleks at 10/12/2005 10:07:23 PM
1> SELECT DISTINCT s.id, s.new, s.modified, s.deleted, s.archived, s.published, s.approved, s.submitted, s.checkedOut, s.aclId, s.parentId, s.ordering, s.templa te, s.publishVersion, w.className, w.version, w.name, w.description, w.summary, w.author, w.date, w.related FROM cms_content_stat...more >>


Combining two rows in a view
Posted by TheCount at 10/12/2005 8:29:23 PM
I have created a view for reporting. I’m basically just joining a few tables. It is for a University so the results shows students names and the credits they are currently taking and the school code (There is 3 Colleges under one ownership) The problem is some students attend two colleges and...more >>

need something like replace but not quite
Posted by Keith G Hicks at 10/12/2005 7:19:33 PM
I need a function that does the following: SOMEFUNCTION(InputValue, 'X', 'The Letter X', 'Y', 'The Letter Y', 'Z', 'The Letter Z', ....) Where if the input value is 'X' then 'The Letter X' is returned and so on. I could write a function for this of course but I was hoping one exists in SQL ...more >>

CELCO - SQL For Smarties 2005 Ed.
Posted by Jerry Spivey at 10/12/2005 7:15:24 PM
Joe, Kudos to you on a job well done. Will be adding your 2005 edition to my personal SQL book library as well as a recommended SQL book for others. Jerry ...more >>

Determine Duration between Two Dates
Posted by David at 10/12/2005 6:21:03 PM
All I have a table of members and I would like to determine how long each member has been a member based upon the current date. I would like the result retuned in the Number of Years, Months and Days ie. 5y 6m 26d. Any assistance would be appreciated. CREATE TABLE member ( M...more >>

how to locate the exact user name who owns a db object
Posted by JJ Wang at 10/12/2005 6:20:01 PM
hi all, In sql 2000, how can you find out the exact user name who owns/created a db object? They are generally recorded as 'dbo' in the sysobjects table, how can we find out the specific user login name behind the 'dbo' entry? many thanks, JJ...more >>

Using views in stored procedures
Posted by Jay at 10/12/2005 6:13:21 PM
Is there any difference in performance between a stored procedure that uses a view and a stored procedure that includes the full select statement defined by the view. Simple example. A real example would involve a view with more joins, etc. View: viewEmployees select * from tblEmployee as...more >>

sysobjects table in user db
Posted by JJ Wang at 10/12/2005 5:53:01 PM
hi, This is a sql 2000 question: Is there a way to figure out when was the last time a databse object got modified (data update, code update, object property update, etc) or accessed by users? It's not in the sysobjects table in user databases. many thanks, JJ...more >>



Help with Join Query Please
Posted by John at 10/12/2005 3:59:58 PM
Hi All, I need help figuring out a query. I have two tables: REQ and PO The schema here is that there can be multiple PO rows per a single REQ row. example: REQ PO -------------- Requistion1 PO1 PO2 PO3 I am creating a query ...more >>

Garbage in, Garbage out
Posted by Mike Labosh at 10/12/2005 3:17:57 PM
Here are a few gems I just found in out JobTitle table, which stores contact job titles in our database. If we have a job title, it's because it came in a bulk-insert data file from a client. The best the big dawg the boss the man The Master Himself THE ONLY PERSON IN IT DEPARTMENT The...more >>

Rollback with trigger?
Posted by Rich at 10/12/2005 1:59:06 PM
Hello, If I cause a Rollback with a trigger, does this cause the outermost trasaction to abort or is flow of control continued? Or is an error batch aborted? Thanks, Rich...more >>

Checking for row existence with secondary key
Posted by Bryan at 10/12/2005 1:00:03 PM
Hi - I'm no SQL wizard (obviously). I have a table (conceivably very large (500k+rows)) with a non-unique secondary index. I need an efficient query to check for row existence using that secondary index. Any ideas will be appreciated... Thanks, Bryan...more >>

Count the number of times an object appears in a table
Posted by Belich Russ at 10/12/2005 12:53:13 PM
Team, I have an IIS log table in SQL Server2000. The table has about 20,000 rows. I need to query the table to find how many times a unique IP appeard in the list based on date and target. The table INETLOG that has fields like USER-IP DATE TARGET I want to know how man...more >>

cast question
Posted by JT at 10/12/2005 12:40:40 PM
if i declare a variable within a stored procedure as a varchar, then later cast it to an integer- will it act as an integer for all subsequent references after the cast? example: declare @myVar varchar(2) set @myVar = '2' set @myVar = cast(@myVar as integer) select @m...more >>

Trigger and external dll
Posted by Patrick at 10/12/2005 12:09:46 PM
Hi Freinds, SQL2000 Can I run an external dll inside the trigger? Thanks, Pat ...more >>

Saving Images
Posted by Steve Zimmelman at 10/12/2005 11:30:22 AM
I'm curious if there are any bottle-neck issues I need to be aware of with an application that stores scanned images into SQL. The app uses a standard SQL Image field for the storage, and TIFF images are being stored in it. Currently my client is adding about 500 records (about 100 megs) per...more >>

Changing ID's
Posted by thewes NO[at]SPAM beckmfg-dot-com.no-spam.invalid at 10/12/2005 11:05:44 AM
I am new to SQL programming and I have a project that is for manufacturing facility. At the start of this project parts wer initially all loaded into a table (tblItems), and then parts wer removed and added as time progressed So, now they want 7000 parts added back from the backup tha origina...more >>

Passing Order By as parameter
Posted by Daniel Wilson at 10/12/2005 9:59:33 AM
A couple months ago, Itzik Ben-Gan offered a nice, paramaterized Order By solution: http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_frm/thread/ae2994003a03954f/1ad2f13eb630fa4e?q=Daniel+Wilson&rnum=1#1ad2f13eb630fa4e select * from titles order by case when @col ...more >>

Sort in a T-SQL function?
Posted by Ryan Langton at 10/12/2005 9:51:44 AM
Is there any way to perform a sort within a T-SQL function? The function takes numerous "floats" as arguments and returns a single string (nvarchar) that lists those floats "float1value - float2value - float3value - etc". Is there anyway to sort those floats before passing them out via the s...more >>

ExportData
Posted by bill_morgan at 10/12/2005 9:21:04 AM
Hi All ... I am looking for simple T-SQL syntax for using ExportData method with Bulkcopy object to export one table in tab delimited, text file format to C:\TableName.txt. First row of text file should be column headers. Anybody know offhand? [TableName].ExportData ??? Thanks for yo...more >>

Insert values from file
Posted by tom at 10/12/2005 9:19:25 AM
Just in general terms (I will look up the specifics), how would I go about doing this? There is value.csv list containing values (000, 001, 002, 003, etc . . ..). There is a table named Attrib. Each value in value.csv needs an Insert Into Attrib. Basically I want to perform the following...more >>

Control of flow around "CREATE PROCEDURE"
Posted by len at 10/12/2005 9:03:01 AM
Hi there. I am trying to write a single script to create some stored procedures. One of the stored procedures however, refers to a database which may or may not be present on the server. In the case of that database NOT being present, I would like to create the stored procedure with differe...more >>

C++ .net data binding
Posted by Jez at 10/12/2005 8:39:28 AM
I have a datagrid control bound to a dataview of a table in a dataset. I am using a tablestyle to control which of the table columns are displayed in the datagrid. When any cell in a row is selected I want to select and highlight the entire row. By catching the mousedown event and using HitTest ...more >>

This is driving me crazy
Posted by Brent White at 10/12/2005 8:24:37 AM
I'm pretty good with T-SQL. We are using SQL Server 2000 and this will be retrieved in Access 2000 via ADO. The problem is that I have a query: select SUBSTRING(VANR,3,4) AS STYLE, CASE WHEN VERA='E' THEN VMGL ELSE VMGS END AS BOOKED, CASE WHEN VDAT>=20030929 AND VDAT<=20040926 THEN CASE W...more >>

Script to change all database object owners at one time
Posted by Charlie NO[at]SPAM CBFC at 10/12/2005 8:08:42 AM
Hi: Does any one know where I can find a script that will change ownership of all database objects at once. I took over control of a large database and changing owners using sp_changeobjectowner one at a time will take forever. Thanks, Charlie ...more >>

calculated valu
Posted by Xavier at 10/12/2005 7:59:03 AM
hello, in a table with 2 fields (department and sales) i have to calculate the sales for the company and the sales excluded spme departments. example original table OnlyDepA 100 OnlyDepB 200 OnlyDepC 500 ............. AllDep. 10000 What i need to calculate What are the sales...more >>

Variable parameter in FROM within a stored procedure
Posted by joshidm NO[at]SPAM gmail.com at 10/12/2005 5:49:50 AM
We are writing this: CREATE FUNCTION TestF() RETURNS varchar(100) AS BEGIN declare @Stock varchar(100) declare @Indicator varchar(50) set @Indicator = 'tbl_stock_master' set @Script = (select fld_stock_code from tbl_stock_master as ind where ind.fld_stock_code = '12345'...more >>

Exporting a table and importing it
Posted by karenmiddleol NO[at]SPAM yahoo.com at 10/12/2005 4:54:08 AM
I want to export 3 tables in a SQL database with the table definition and want to then import from this dump into another SQL database where these tables do not exist. The tables are - Cust, MatProd, Plant the database to be exported is - SourcePur and the database these table have to be cr...more >>

trigger for insert
Posted by Lotus at 10/12/2005 3:30:02 AM
hi all, IN Sql Server: i need to create trigger on table A as when i insert new row in Table A ,new record will be inserted in Table B which has the same primary key of Table A please Help thank you ...more >>

SQL updategrams for delete queries
Posted by Theo at 10/12/2005 2:44:05 AM
Hi! I'm a newbe to SQLXML and SQL updategrams. I know that it is possible to delete specific rows from a database using SQL updategrams. My question is: Is it possible to delete ALL rows from a table using updategrams? In other words, I would like to express the query: "delete from TABLENA...more >>

Calculate Time between pairs of records (TimeTicket)
Posted by Damiano at 10/12/2005 12:45:02 AM
I have a table like this Job, EventType,TimeEvent A,Start,12/10/2005 10:00 A,End, 12/10/2005 10:30 B,Start, 12/10/2005 10:31 B,End, 12/10/2005 11:45 and so on... Which is the way to have a quey result with Job, JobTime (in minutes) A, 30 B, 74 Thanks...more >>

date question
Posted by Neil Jarman at 10/12/2005 12:00:00 AM
Hi, I need to get just the date part from getdate(), eg I need to test for dDate > getdate() but the RHS should be today 12am. What's the correct function for this? Cheers, NEIL ...more >>

stored proc - scope_identity
Posted by soc at 10/12/2005 12:00:00 AM
Hello, Can a stored proc add a record to one table, and then having retrieved the scope_identity, add a record to another table? Would the following code be appropriate? Thanks Soc. CREATE PROCEDURE [dbo].[usp_addto2tables] @a_variable1 INT, @a_variable2 INT, @a_variable3 INT, @b_...more >>

Moving File Groups to a new location
Posted by gene h via SQLMonster.com at 10/12/2005 12:00:00 AM
I have been looking for a thread with information on how to move a database with a file group in it. Basically I need to relocate ( due to newer disks) a database to a new set of drives. I am going to use the current disks for logs only. But back to the question I know how to use sp_dettach_db to...more >>

Sync Table structures in two database.
Posted by Agnes at 10/12/2005 12:00:00 AM
i got two database (A & B) with same structures, now, I need to add two fields in one table in database A , now , i need to modify with database B also, Any shortcute , and I sync their table structures ?? [both database got the data inside] ...more >>

Help with finding/updating/deleting Dupes in 2 tables
Posted by dale_durham via SQLMonster.com at 10/12/2005 12:00:00 AM
Being fairly new to SQL and SQL scripting, I am at a loss on how to proceed on my issue. I have a MSDE database with 2 tables that need to modified. I am changing to a standard 12 digit code in my PATIENTS table for the field sChartCode. That code will be in the form of 110012345678. 1100 wi...more >>


DevelopmentNow Blog