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 > november 2004 > threads for monday november 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

Hash/Loop join
Posted by Leila at 11/22/2004 10:23:53 PM
Hi, I have a query based on some views(joins 8 tables). The execution plan shows that each pair of tables are joined using loop join which is fine. Suppose that there're 4 pair of tables. In the rest of plan, the result of each pair is joined with result of another pair using hash join. Are my ...more >>


sql join question
Posted by CFI at 11/22/2004 10:11:36 PM
Hi, Your help would be highly appreciated! I have a next kind of problem. I have two tables A B A table includes some information about production. Example product A has been made in two days, so information i need is on a two lines and both lines has different date information(20...more >>

Description of a field
Posted by Leila at 11/22/2004 8:58:53 PM
Hi, Are there any system function/sp/view to retrieve description of a field. Thanks, Leila ...more >>

How to import a DTS file into EnterpriseManager's Local Packages
Posted by A.M at 11/22/2004 7:43:41 PM
Hi, How can I import a DTS file into Enterprise Manager -> Data Transformation Services -> Local Package ? Thanks, Alan ...more >>

converting many rows into a text field
Posted by shank at 11/22/2004 6:35:36 PM
I have the following columns... [DiscNo] [Song] [Artist] Each Disc has many song titles. I need to get the song, artist and a consecutive number representing the track number into one text field. i.e. In the end, for each DiscNo, there will be 1 row and 2 columns. How do I approach this? I ...more >>

Temporary table not dropping
Posted by Samuel Allan at 11/22/2004 6:13:04 PM
I have a problem. I have a couple of stored procedures that generate datasets for reports. Both of them utilise temporary tables to help build up the result set. The temporary tables in each stored procedure are named the same, but they have different definitions. Each stored procedure deletes...more >>

group or role membership
Posted by djc at 11/22/2004 5:58:32 PM
I currently use the suser_sid() SQL function to retrieve the currently logged on user in an asp.net application. If I wanted to take it further and also check for group membership, or role membership, how could I do that? any info is appreciated. Thanks. ...more >>

Loop through a SQL database.
Posted by Andrew B at 11/22/2004 5:49:57 PM
I need to get a combination of PHP and SQL code to do the following: I want to look at the contents of a table and determine the range of an ID. I know my test table has ID's in the range of 28 to 30. I want my sql query to return the range so I can tell a php program the results so it knows...more >>



What counts as a transaction
Posted by Eric Tishkoff at 11/22/2004 5:03:01 PM
My company is in the market for a new DB server and we're seeing a common spec of transactions/second. That's got us wondering about what the hardware makers consider a transaction. Any ideas? Is there a standard of measurement? Along these same lines several co-workers got into a conversatio...more >>

Insert SP from multiple tables
Posted by Leon at 11/22/2004 4:20:43 PM
How do I insert unrelated statistical data from three tables into another table using an stored procedure? OR How do I write an insert stored procedure that has multiple select statements I know how to use a joins but all I need to do is count the number records in the customer table, winn...more >>

Help with query
Posted by Micromanaged at 11/22/2004 3:30:12 PM
Here is my query: SELECT max(sf.[DateCreated]) as [Date Schedule Created], dbo.Schedule.ID, dbo.Schedule.[Customer ID], dbo.Schedule.[Equipment Amount], dbo.Schedule.StatusCode, dbo.Customers.Contact, dbo.Customers.Type, Company.[Company Name], [Users Fields].[User Field 13] as [Estimat...more >>

How to strip out characters ?
Posted by Rob C at 11/22/2004 3:15:54 PM
I need to strip out both spaces and dashes contained in a column ? How might that best be accomplished ? Sample inputs ABC 123 ABC-123 Either of these should result in the sample output ABC123 Thanks ! ...more >>

How to connect as guest?
Posted by Tumurbaatar S. at 11/22/2004 3:14:48 PM
I tried 2 variants of ADO connection string, but connection fails: 1. Provider=sqloledb; Network Library=DBMSSOCN; Initial Catalog=Services; User ID=guest; Data Source=127.0.0.1,1433; 2. Provider=sqloledb; Network Library=DBMSSOCN; Initial Catalog=Services; Data Source=127.0.0.1,1433; The S...more >>

[MSSQL] Identity and alter table ???
Posted by Szaki at 11/22/2004 3:12:55 PM
hello, I have a table DANE DANE --------------------------------- IMIE NAZWISKO WIEK DZIAL IMIE_DZIECKA IMIE_DRUGIE_DZIECKA NAZWISKO_DZIECKA MIASTO ULICA TELEFON STANOWISKO CZAS_PRACY in this table I must add column IDdane so I use Alter Table who looks that: ALTER TABLE tmp2...more >>

Text version of execution plan?
Posted by Carl Imthurn at 11/22/2004 2:47:16 PM
Hello gang -- Is there a way to produce a 'text' version of the graphical execution plan; specifically, the information that appears in the light yellow 'tool tip' window when you hover over one of the execution plan icons? Here's why: I need to tune one of my stored procedures, and I don...more >>

Append to a table
Posted by j1c at 11/22/2004 2:33:18 PM
I have a pair of columns: id name 1 bob 2 ted 3 jim 1 jon 1 tim 3 mic 5 tim Any way to query them out to show all the ID=1 with the name in 1 row? id name 1 bob,jon,tim 2 te...more >>

check if temp table exists on 6.5
Posted by Rick Charnes at 11/22/2004 2:25:52 PM
I sometimes have a temp table called #temp_sp on a database where sp_dbcmptlevel returns 6.5. I want to drop this table if it exists. This code: IF OBJECTID('tempdb..#temp_sp') IS NOT NULL drop table #temp_sp returns: Server: Msg 195, Level 15, State 10, Line 1 'OBJECTID' is not a re...more >>

pass parameter via Query Analyzer
Posted by smk23 at 11/22/2004 2:25:01 PM
I apologize in advance for such an elementary question, but I searched BOL and MSDN site and still can't find it. I am trying to test my stored procedure with query analyzer and need to pass a couple of parameters. The SP requires @par1 and @par2. My line in QA is: Exec gp_vwSomething...more >>

Select Into / Distinc / Identity Question.
Posted by Renato Maia at 11/22/2004 2:23:03 PM
Hi all, I want to create a table containing only distinct values from one big table's field. I would also like to have a numerical id field associated to each distinct value. I execute "select distinct field from table1" and get + - 70 rows. If I try : select distinct field, id = identi...more >>

Alter table
Posted by Ed at 11/22/2004 1:55:14 PM
Hi, What is the T-SQL to change the data structure from Null to Not Null?? Alter table alter column ??? Thanks...more >>

Query help
Posted by Yaheya Quazi at 11/22/2004 1:52:17 PM
here is the structure of my table.. appt_begin_date type datetime pay_schdule char(2) example data 7/1/2001 BW 11/1/2004 MO 1/1/2004 BW I want to pick row number 2 because it is the closest to current date (getdate()). How can I do that? Thanks!...more >>

Select case not returning value specified
Posted by gv at 11/22/2004 1:34:12 PM
Hi, The following returns null values in the last column "label" in the Results set. How should I change the query to put D or B where the results equal the value I showed? Of course I just creating the column Label in the results set. any help would be gratefull SELECT vid,vdate,vpn...more >>

building a table
Posted by Munch at 11/22/2004 1:27:02 PM
I am looking for a way to write a query that will allow me to compare records and accordingly assign a value. For example: I have Table A which has the following columns: ExtractDate, ID, HireDate, StatusCode I need to write a query that will build TABLE B with columns: ID, HireDate...more >>

Error in Arithmetic Operations
Posted by payyans at 11/22/2004 1:17:03 PM
Hi, Ref: SQL Server 2000 SP3 I have tested the following from the Query Analyzer Test1: Select 1999999.0999/'77.88887779999999988888888' Result: 25677.5882044809979342 Test2 Select 1999999.0999/77.88887779999999988888888 Result: 25677.59552314 Does anyone know what kind of ...more >>

Converting datatype
Posted by Tor Inge Rislaa at 11/22/2004 1:15:45 PM
Hi I have two fields in my table that I want to merge into one field. My original selection is like: SELECT MyDescription, MyNote FROM MyTable The merging works fine if the fields are the same datatype (VARCHAR): SELECT MyDescription + CHAR(13) + MyNote FROM MyTable The output looks s...more >>

Why can't variable assignment occur in a data retrieval operation?
Posted by Novice at 11/22/2004 12:59:04 PM
Hey all, I just ran across a peculiar "feature" in SQL server. I wrote this stored procedure that is set up to return multiple result sets (from 3 different select statements). I could make the 3 different select statements MUCH more efficient if I could assign some data from the first selec...more >>

more help with complex SQL query
Posted by jamesmgiordano NO[at]SPAM yahoo.com at 11/22/2004 12:47:10 PM
OK, I have another SQL query that I am trying to do with a left join in. Here is the problem: I have two tables, one acts as a lookup for the other, but the lookup table may have more than one record for each distinct record in the other. For example: Table1 ID NAME 1 Todd 2 ...more >>

Retrieve Raiserror
Posted by Ed at 11/22/2004 12:41:08 PM
Hi, Is that possible I could do something like -- put the error message into a variable? e.g. Declare @ErrorMessage nvarchar(50) output Set @ErrorMessage = Raiserror(50001, 16, 1, 'Sorry') Return I would like to return the error message back to front end... Thanks Ed ...more >>

Some question about calling to function and refer to another DB and alias
Posted by mttc at 11/22/2004 11:15:40 AM
Sql 2000, I have som q: *I see that need to add owner when I call to function, like that: “select dbo.MyFunc” when I call like that “select MyFunc” I get Err why? Have way to omit owner? *when I refer to table from another DB, we must write like that: “DB2.dbo.Table1” Have way to o...more >>

CONTAINSTABLE weight
Posted by RGM at 11/22/2004 10:47:03 AM
I am search text fields, I have every setup already and I am able to do CONTAINSTABLE and FREETEXT... When I use weight the numbers dont make any sense. I really would like to be able to specify a value for the my keywords and also determine what words were found when I run the query. Right ...more >>

Partitioned view and defualt table.
Posted by s_erez NO[at]SPAM hotmail.com at 11/22/2004 10:43:02 AM
Hi, Can i define a defualt table for a Partitioned view, so when i insert data into the view and the data dosen't meet any of the conditiones defined on the tables, the data will be inserted to the defualt table. Regards, Erez....more >>

Column alias in Select with Case
Posted by DWalker at 11/22/2004 10:33:04 AM
I need to do something like this: Select Case When Field = 'Y' Then 'Something' Else 'Something Else' End As FieldName End From ... Where ... But QA chokes on the As statement. Can't I give a field an alias when I'm using a Case statement? I hasve tried moving the End statement after As ...more >>

Subquery
Posted by Prateek at 11/22/2004 10:28:38 AM
Hi All, Seems like a simple question.. but I am unable to find the answer for this! I have a query like the following: select col1 from table1 where company_id in (select company_id from company where company_Type = 0) Now this query returns col1 values for all rows where company_id ex...more >>

Stopping a query on SQL server
Posted by robeneal at 11/22/2004 10:09:09 AM
How can you stop a query that is run from a program using ADO.net on SQL server? I would like the user to be able to cancel a running query. -- Robert Neal West Palm Beach, FL USA...more >>

Divide by zero problem
Posted by Vincel2k2 at 11/22/2004 10:05:08 AM
I am upsizing an Access database and it has a pass through Query that contains this (UNITS / CASES as PerCaseQty) expression as a calculated field. There are some records in both UNITS and CASES that contain Zero’s, so of course I am getting a divide by zero error. In Access I could resol...more >>

How to avoid Nulls
Posted by Rich Rekos at 11/22/2004 10:03:18 AM
Hi All, I an a newbie to SQL queries and need to select rows from a contact DB where Address, City, State, Zip aren't null. I hope I am using the right lingo. Basically, if any of those fields are blank, I don't want them. I tried using city is not null and zip not is null, etc. but the query...more >>

SP **
Posted by maryam rezvani at 11/22/2004 9:51:36 AM
Hi I've a Stored procedure in SQL server 2000 and when I run it in Query analyzer there's no problem and it fetches the result in 2 seconds,but when I run it in VB6 via an ADO connection with executing it throght a command and ofcourse I make the connection timout property more than before, ...more >>

Complex ( for me) Query.
Posted by PVR at 11/22/2004 9:46:17 AM
Hi sql Gurus, I have a history table with the following structure create table #temptab ( seqnum int , partnum int , code varchar(2) ) insert into #temptab values (10,4041409,'C') insert into #temptab values (20,4041409,'A') insert into #temptab values (30,4041409,'B') insert in...more >>

table structure documentation
Posted by Ed at 11/22/2004 9:35:02 AM
Hi, Currently we need to review all tables (80) in a database Is there anyway to print out all the table structures for each table. Like Northwind... Customers CustomerID Identity LastName nvarchar(50) Thanks Ed...more >>

whats wrong with this SQL?
Posted by dhnriverside at 11/22/2004 8:57:47 AM
Hi guys I'm having a problem with an auto generated SQL statement. Here it is.. SELECT ProjectID, ProjectName, ProjectClient, DartsContact, LeadArtist, AreaOfWork, AreaOfDoncaster FROM Projects WHERE ((Running = 1) AND NOT (ProjectName LIKE '%music%' OR ProjectOutline LIKE '%music%' OR A...more >>

SQL Query - Points Calculation
Posted by Justin Drennan at 11/22/2004 8:54:58 AM
Hi Guys, I have a system which allocates points to individuals based on their status, and the number of points earned per month. As you get more points you move through statuses, and as you move through statuses, you get more points given to you. % Allocated per Status --------------------...more >>

SQL Text Size Limit?
Posted by CSikes at 11/22/2004 8:52:16 AM
I'm connecting to a SQL Server 2000 database through ODBC. Is there a size limit in the length of a SQL string that I can pass to the database for processing? Please let me know if any of you have seen a maximum....more >>

Date conversion
Posted by Mal at 11/22/2004 8:25:04 AM
Hi I got this statement, now I don't have problems converting dates to what I want, but I do have trouble trying to understand why SQL want to conver the value in my else () to a date. select case when ((isnumeric('2004') = 0) and (isdate('2004') = 0)) then (convert(datetime,'2004',111)...more >>

Stored proc with version number ?
Posted by SPaquin at 11/22/2004 7:53:08 AM
Hi everybody. After examining ways to add parameters while maintaining existing apps compatibility, I have decided to use stored procedure appended with a version number. So that stored proc named uspTableSave has a new version uspTableSave;2. I just tried to implement that in SQL Manager and...more >>

Help with query.....
Posted by Paul at 11/22/2004 7:06:46 AM
I have this query which I've left running for around 8 hours and does not return (but is eating a lot of CPU and DISK IO). The server is pretty powerful, Windows 2003, SQL 2K (all patched/hot fixed) 8 Gig Memory, 4 CPU, connected to an EMC disk array. The server never goes above 25% used, 1.1...more >>

Parallelelism pour performance
Posted by roustam NO[at]SPAM hotbox.ru at 11/22/2004 5:17:56 AM
Hi! I have a similar query, that runs fo 30-60 seconds with [max degree of parallelism] equal 1 and for 5-20 minutes with [max degree of parallelism] equal 4 or 8 (I have a four-processor server with HT enabled): ------------------------------------------------------------------------------...more >>

Cursor Comparision (current to next)
Posted by Catadmin at 11/22/2004 5:17:02 AM
I have a SQL 2000 table that I am trying to delete duplicate containers out of that have an earlier date then the last date placed. I've written the following cursor, which parses fine with no errors, but runs forever. When I added a print statement to find out where the cursor was stuck, I ...more >>

Stored Procedure
Posted by franklinbruce NO[at]SPAM gmail.com at 11/22/2004 4:16:47 AM
Hi all, my requirment as follow Table Structure: Hospital_Assigning -------------------------------------------- Date Phy_id Hospital_id default_hospital ---------------------------------------- Phy_id Hospital_id I need a stored procedure which need to check if there is ...more >>

SQL Reporting with SQL Server 2000 - urgent problem!
Posted by Oliver at 11/22/2004 3:42:19 AM
Hello, I hope you have a minute to help me, it would save me many hours (already spent many on this problem). I am trying to use the render function of the sql reporting web service to get output, however I need to define a DataSourceCredentials object first. I do that with this code Dim...more >>

List like View-TaskPad on Enterprise Mgr
Posted by Craig HB at 11/22/2004 1:35:02 AM
How can I get a list of tables and indexes in a database, showing rows and size. Something similiar to what you get when you select View-TaskPad on Enterprise Manager, but printable. Maybe there's a system stored procedure I can use. Craig...more >>


DevelopmentNow Blog