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 > november 2005 > threads for wednesday november 23

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

sql query trivia
Posted by joeycalisay at 11/23/2005 9:26:03 PM
hi guys! just want to know if the answer on this thread is the best one. please check it out: http://msforums.ph/forums/87274/ShowPost.aspx i don't know if the bitwise operation generates the most efficient query, please verify, thanks! ...more >>

how do I check if constraints exists?
Posted by Hans [DiaGraphIT] at 11/23/2005 9:01:01 PM
Hi! I want to create constraints, but I want to check if the constraint exists first. How do I do that? I think something like following example would work for me, but I'm not sure how to check... filling the space between ...exists (...) IF NOT EXISTS (.......) ALTER TABLE UserTab...more >>

Dynamic WHERE & Dates
Posted by Scott at 11/23/2005 7:16:44 PM
My dynamic sql correctly returns the top 10 dates with records if @timeID equals 1. I need the @timeID equals 2 part to return records between @dtStartDate and @dtEndDate. (I just set the enddate equal to maxdate to keep my example simple). In the below section where @timeID = 2, I'm gettin...more >>

Need some with query
Posted by Rick Shaw at 11/23/2005 4:49:55 PM
Hi, I need some help formulating a query. Below is an example records. What I am trying to do is to come up with a query that will tell me which record has a position_startdate that is less than position_enddate from the record above. ID EMP_ID POSITION POSITION_STARTDATE POSITIO...more >>

Full-Text search indexing HTML content
Posted by bacusgod at 11/23/2005 4:45:54 PM
I've been quite busy these days looking up which was the best way to create a full-text search catalog for a field composed entirely of HTML content, and I found out that the best way to handle it, so it could ignore HTML tags as the search was performed, was to make the column an Image-type ...more >>

Call Stack Level
Posted by Altman at 11/23/2005 4:36:56 PM
I figure there is someway to pull this out but I can't find it anywhere. I have a recursive stored procedure and I want to error out if it recurses more than 10 times. How can I pull out how deep in the call stack I am? Is this possible? I know I could pass a parameter to the stored proced...more >>

Chinese character in the field (Sql 7)
Posted by tractng NO[at]SPAM gmail.com at 11/23/2005 4:03:50 PM
Guys, I have to replace some old chinese characters (words) with some new ones. In the database, the fields are displayed as ???. The current chinese characters will display fine when you retrieved the fields through the website. As soon as I cut and paste the new chinese characters onto ...more >>

error Multi-part identifier
Posted by bubixx at 11/23/2005 3:15:02 PM
After OK parse, I try to execute this statement in a trigger: if inserted.col1 = 10 --col1 type int --do instruction But I have this message: The multi-part identifier "inserted.col1" could not be bound. What is this problem?? How can I resolve it??? Thanks! Good night!...more >>



Profiler and SQL Express
Posted by SM at 11/23/2005 2:23:35 PM
I'm just wondering if I install SQL Express + Express Manger will this include SQL Server profiler ? If not is there any way to get SQL Server profiler without purchase a complete version of SQL Server 2005 Standared or Entreprise editions ? Thank you ...more >>

query metadata within trigger scope
Posted by wapsiii at 11/23/2005 1:47:14 PM
I have a few tables which I'd like to protect from accidental deletes. I'm thinking adding an INSTEAD of trigger on DELETE to the table that raise an error and return could be an approach (not sure if its the best). Something like: CREATE TRIGGER trig_DeleteNoAllowed ON sandbox.dbo.Table1 ...more >>

Weird problem: Cannot run Left Outer Join properly - SQLserver 2000
Posted by Bill Nguyen at 11/23/2005 1:36:19 PM
The following statement will display all records in WF_FMDispatch table. In this case, the LEFT OUTER JOIN is working. However, as soon as I filter the WF_SupplierEntity table , only records with matching pair f_vendor_no = factorSupplierID are shown (statement #2). Am I missing something here...more >>

help with joining on an index
Posted by news.microsoft.com at 11/23/2005 1:24:03 PM
I'm trying to speed up a query by joining on a known index. However, I've forgotten the syntax. Could someone please help me? JOIN Cases C WITH(NOLOCK) ON D.DoctorID = INDEX(Cases_Doctor) <-- here!! Thanks a million, Patrick ...more >>

Table Hints
Posted by JY at 11/23/2005 1:05:55 PM
Hi everyone, I have 2 questions regarding table hints: 1) While doing INSERT/DELETE/UPDATE which table hint makes more sense: with (rowlock) or with (updlock)? Is there any difference between the two? 2) From SQL Server Help: "UPDLOCK has the advantage of allowing you to read data (witho...more >>

len of string
Posted by Owen at 11/23/2005 12:43:15 PM
Hello: I have a table with id (int) and text1(varchar) that import from .dbf and I have to get all row or record that have some len in this text. I make this query: select id, text1, len(ltrim(rtrim(text1))) as length from table but I have some text1 with this values '' and havethat th...more >>

Run 2nd SQL in stored proc
Posted by David Chase at 11/23/2005 12:19:16 PM
I have a stored procedure (see below) that inserts records into a history table from a source table (PayTotals). After that is successful, I would like to run a delete statement "DELETE FROM dbo.PayTotals WHERE PaidYr = @PaidYr" but only if the previous INSERT is successful. What would I nee...more >>

updating column
Posted by bic at 11/23/2005 11:55:04 AM
How do i update a column to the similar column of a similar table with common keys? Thanks. -- bic...more >>

howto update from another table
Posted by Abraham Andres Luna at 11/23/2005 10:59:55 AM
hey everyone, i want to update this table COEMP EmpId - Email 999 - NULL with this data RDKCOEMP EmpId - Email 999 - abe@rdk.com i tried : UPDATE COEMP SET Email = SELECT Email FROM ad_2000_beta.dbo...more >>

2005 Pivot Question - Not returning data..not sure what i did.
Posted by Daniel Regalia at 11/23/2005 10:52:04 AM
Okay, using examples I found on the internet, I managed to piece this together. Now the part in the data section, works, and i get the data to come out. Once I add the pivot to it, it stops producing results. I am guessing that I have 2 or 3 major problems with this. 1. Where do i sen...more >>

is this a lot
Posted by rodchar at 11/23/2005 10:39:05 AM
hey all, is a 5-table join a lot of tables? the reason why i ask because this one table has so many code fields (that reference master files which contain descriptions i need for a report). how do you get around that? thanks, rodchar...more >>

Query Help
Posted by Eric at 11/23/2005 10:36:02 AM
I have two tables: Trans & History. For each record in Trans, there can be many in History. I want to return records in the Trans table that have a certain status in the History table but not other statuses. Here's an example: select transactions.transaction_id, name from transactio...more >>

which is better...
Posted by rodchar at 11/23/2005 10:31:04 AM
hey all, is it better to build a view and use it in a stored procedure -or is it better to put the T-SQL used to created the view directly in a stored procedure and not use a view altogether? thanks, rodchar...more >>

SQL Execution order
Posted by Mnemonic at 11/23/2005 9:58:28 AM
While talking about breaking some larger queries into a parallel process with a college, they propsed that SQL may decide to execute code in basically any order it feels like (per any determined execution plan). I asked for an example of this, but thought it'd propose the question here for a qu...more >>

Using set theory in SQL Server 2005
Posted by Billy at 11/23/2005 9:29:06 AM
Hi all! Hope you can help me to find a way to do a quite tricky calculation. The task is to calculate the amount of time an ATM (Automatic Teller Machine/Cash machine) is available to the public. It may be unavailable due to failure of the machine, inacessible location (closed shopping mal...more >>

with(updlock) - How many times on same table in single update?
Posted by Steve'o at 11/23/2005 9:09:05 AM
SQL SERVER 2000 SP3a My question is not about this exact statement, its to do with table hints. How many times do I specify the table hint _with (updlock)_ when the same table is used in a statement. eg update table_a with(updlock) set table_a.col_1 = b.col_1 from table_a a with(up...more >>

Is there alternative to T-SQL USE <dbname> where <dbname> is varia
Posted by RMarmion at 11/23/2005 8:56:03 AM
Strangely, I cannot find a description of the USE T-SQL command in any Microsoft documentation and Help that I have. Within a script it is used to set the focus of the subsequent T-SQL commands to a specific database. Normally I'd use: USE DB1 CREATE PROCEDURE A .... USE DB2 ...more >>

query multiple files
Posted by George at 11/23/2005 8:43:01 AM
Hi all, First Happy Holidays to all and a big thanks for all those who help us in our times of need :) I am writing a vbscript/ASP app for our website and have come across a problem. We have three external databases, first is the member database, second is the dependent database, third is t...more >>

Range Scan vs. Table Scan
Posted by Roger Twomey at 11/23/2005 8:26:49 AM
I am clear on what a table (full) scan is, but I am NOT clear on a Range Scan. It seems that a Range Scan is a searching of a sub-set of values from an index (if I am reading it correctly). That being the case, does that mean that Range Scans are the normal operation of a select on an indexed ...more >>

9KB of update statements FILLED with NOLOCK hints
Posted by Mike Labosh at 11/23/2005 8:22:54 AM
and she wonders why it doesn't work. I will now crawl back under my rock. Thanks for listening. -- Peace & happy computing, Mike Labosh, MCSD "When you kill a man, you're a murderer. Kill many, and you're a conqueror. Kill them all and you're a god." -- Dave Mustane ...more >>

Does RAISERROR store values for @@ERROR?
Posted by Joel at 11/23/2005 8:19:16 AM
I tried to write some test code that looks like: DECLARE @ErrorValue int sp_addmessage 50001,10,'This is a test error message' RAISERROR (50001,10,1) SELECT @ErrorValue = @@ERROR If @ErrorValue <> 0 ...etc. I expected @ErrorValue to be 50001, since I tried to move @@ERROR t...more >>

Query to extract number of duplicates
Posted by poppy at 11/23/2005 8:15:05 AM
This query is driving me insane. I need to extract the number of rows in tblUsers where the first 3 characters of "fldSurname" are the same and they where born "fldDOB" on the same year and month. Can anyone help ?...more >>

Accessing WMI using sp_OACreate
Posted by John Barr at 11/23/2005 7:40:04 AM
Does nayone have any insight into how to access WMI using sp_OACreate?...more >>

COUNT of datediff
Posted by ugom at 11/23/2005 7:38:03 AM
Ok... it's stupid but I'm getting crazy... SELECT DATEDIFF("D",ORD_DTRSC,BLT_DATA) AS DAYS FROM BOLCLI INNER JOIN ORDCLI ON BOLCLI.BLT_NORD=ORDCLI.ORD_NUM AND BOLCLI.BLT_PRORD = ORDCLI.ORD_PRG WHERE ORD_DTRSC > 0 how can I have the COUNT() of the days grouped by positive and negative? s...more >>

passing \ as a parameter to a function
Posted by RMarmion at 11/23/2005 7:16:22 AM
I have a UDF for splitting delimiter strings: CREATE FUNCTION Split (@Source varchar (5000) ,@Delimiter varchar (10) = ',' ) RETURNS @T table (F1 varchar (100)) AS --Accepts a source string @Source and parses it to break it up into single units --delineated by @Delimiter. --Returns a ...more >>

error in calcualting week nr over DATEPART
Posted by Xavier at 11/23/2005 6:25:07 AM
hello, i have the problem that the week nr calcualted from the actual date in not localized.... in germany for example - from 21.11.2009 till 27.11.2005 there is the week nr:47 if i execute in the queryanalyser Print DATEPART(wk, CONVERT(datetime,GetDate(),104)) Print DATEPART(wk, CON...more >>

Composing a date from date parts
Posted by aroraamit81 NO[at]SPAM gmail.com at 11/23/2005 3:44:37 AM
I have three date parts namely, Year Month Date/Day as integer values stored in one column each in a table in a SQL Server 2000 database. I need a function to serialize/compose/create a datetime type out of them so I could use that in a query (pseudosyntax) as below: SELECT CreateDat...more >>

Using a cursor
Posted by Patrice at 11/23/2005 3:30:10 AM
Is it wise to use a cursor to loop through records and use SET commands for variables for a very large table - like 1.2 million records? Thanks!...more >>

Case Statement
Posted by vanitha at 11/23/2005 2:09:04 AM
hi, my procedure is create procedure ct_tpin(@Start_Date datetime,@End_Date datetime,@Rpt_Name varchar(50)) as begin case when @Rpt_Name = 'TpinGenerated' then select gr_tpin_flag_t.KEY1, gr_cust_m.Name,gr_tpin_flag_t.dateandtime FROM gr_tpin_flag_t, gr_cust_m WHERE (gr_tpin_flag_t....more >>

Viewing the Statement
Posted by Ghulam Farid at 11/23/2005 1:38:37 AM
Hi to All! is there any way i can view the staements issued by the user against a particular database without starting a sql profiler trace. Thanx *** Sent via Developersdex http://www.developersdex.com ***...more >>

Delete Query ?
Posted by Luqman at 11/23/2005 12:00:00 AM
I have following Invoice Nos. LS-123 LS-123R LS-123A LS-124 LS-124R LS-125 LS-126 1. I need to delete all invoice nos. which have been issued again as 'R' at the end of Invoice No., for example: LS-123 2. I need to delete all invoice nos. which have 'R' at the end of Invoice No., for...more >>

Anyway to quick ntext Search
Posted by Islamegy® at 11/23/2005 12:00:00 AM
Helloo.. I there anyway to make ntext search faster?? I have a table of legal documents with 2 million text record, While no full text index & search on text fields searching with "Like is very very slow". I need anyway to make it faster using any techniques.. Do i need to use cursor or how ca...more >>

DateName always return DatePart!
Posted by Immy at 11/23/2005 12:00:00 AM
Hi all, I have a Japanese SQL2K server that uses the following servertime format returned by getdate() - 2005-11-23 23:29. The problem i'm experiencing is when I use the DATENAME function, it returns me the INT value for November (11) and not the name. Very weird. It works correctly on m...more >>

Complex delete query
Posted by Petar Popara at 11/23/2005 12:00:00 AM
Is this valid query: select a.ID_Attachment FROM attachment a INNER JOIN message_attachment b ON a.ID_Attachment = b.ID_Attachment INNER JOIN message c ON b.ID_Message = c.ID_Message WHERE c.ID_SOMETHING = 1 ? ...more >>

Adam rocks..
Posted by news.microsoft.com at 11/23/2005 12:00:00 AM
Adam, This link http://www.sql-server-performance.com/covering_indexes.asp was exactly what I needed. Thank you. Sincerely Patrick ...more >>

Connection Error
Posted by Raju Joseph at 11/23/2005 12:00:00 AM
Hi I have a VB6 program that talks to SQL Server 2000 database. The Connection String is as below: Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & M_USER_NAME & ";Password=" & M_PASSWORD & ";Initial Catalog=" & Database & ";Data Source=" & M_SERVER When the program is idle...more >>


DevelopmentNow Blog