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 > august 2004 > threads for friday august 20

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

Joining Tables Problem with two references to same column (Inner Join?)
Posted by rcolby at 8/20/2004 11:33:29 PM
Hello All, Please bear with me if this doesn't make sense, this is all new to me and never really worked with SQL before other than an oracle module at uni (well forgotten by now). I have these three table for example : Table 1 Table 2 Table 3 ---...more >>


Query returning best match
Posted by lasse at 8/20/2004 10:35:40 PM
I have two tables, A and B. Table A consist of article headers, while table B consist of article Numbers. Each article number`s first 2-5 digits is the header number. After the header number there is 1 to 5 additional digits giving the uniqe article number. I want to be able to do a lookup tow...more >>

Indexed Views - What edition????
Posted by Andre at 8/20/2004 8:21:01 PM
Hello all, I am in a big dispute with my boss of indexed views. He told me that they can only be created in SQL 2000 Enterprise Edition. I think any version can create them. We went out and tried to find the answer on Microsoft, but we found strange things. We found places where it vali...more >>

temporary table or function
Posted by amish m shah at 8/20/2004 7:48:38 PM
Hi all gurus What is more beneficical Temporary tables or Functions. -- Thank and Regards Amish M Shah ...more >>

getting Error message
Posted by Anitha T at 8/20/2004 5:49:01 PM
Hi When I try to execute distributed stored procedure then I am getting this error message. What may be the reason? The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction. [OLE/DB provider returned message: New transaction c...more >>

Performance of old style vs new style JOIN syntax
Posted by Jeff Mason at 8/20/2004 5:42:25 PM
I was wondering if there are any performance differences between the "old" style JOIN syntax where the JOIN condition was buried in the WHERE clause and the "new" style where the condition is specified in the ON clause. In my opinion, the new style is easier to read and keeps the WHERE clause f...more >>

Subqueries (I Think)
Posted by Susan Cranford at 8/20/2004 5:36:55 PM
I am developing a complex set of reports with an ASP front end and a SQL Server 2000 backend. I don't want the user creating temp tables (I'm not a web expert but that doesn't sound logical) and want to know if there is a way to execute this sequence that works: DELETE FROM seTemp INSERT I...more >>

T-SQL: Checking for RowGuid column
Posted by Ed West at 8/20/2004 5:30:10 PM
Is there a way to check for rowguid column in t-sql? I am writing some build scripts and need to alter an existing column... I didn't find anything in BOL or looking around the web... this GUID stuff wasn't in 6.0 and 6.5 when I used to write this scripts a lot more! :) thanks -ed...more >>



creating a primary key from existing ID's
Posted by ASP.Confused at 8/20/2004 5:24:39 PM
I have a table that I transferred to my SQL server. It lost the primary key information, and I would like to make the field a primary key. When I attempt to do it in SQL Enterprise Manager, it gives me an error saying: 'menu_topbar' table - Unable to create index 'PK_menu_topbar'. ODBC er...more >>

inner and outer joins not associative
Posted by Andrew John at 8/20/2004 5:03:13 PM
SQL people, I have a requirement to select all rows from one table, together with matching rows from a whole lot of inner joined other tables. I did want to put the first table first in the query, but can't seem to get this working: Create Table A ( Aid int, A varchar(10) ) Crea...more >>

select LEFT
Posted by Darren Woodbrey at 8/20/2004 4:58:24 PM
How can I select all character to the left of a certain character. I need to select all characters to the left of a "/". LEFT will not work because the amount of characters will be different in each case. Thanks! Darren ...more >>

Script to Job Start / End Time
Posted by John at 8/20/2004 4:22:05 PM
I am looking for SQL script that will display the SQL Server jobs the beginning and ending times that run on my SQL Server 2000 database within the last two days. Thanks, John ...more >>

Stored Procedure - Timeout
Posted by Paul Say at 8/20/2004 4:20:26 PM
I have a stored procedure that on execution updates various tables in a database. This procedure takes some time to run. When called from client applications(asp.net) the procedure causes the application to time out. What I want to know is if there is a way that stored procedure can be called...more >>

SQL 2005 Beta 2 Question
Posted by Immy at 8/20/2004 4:16:17 PM
Has anyone tried to install Beta2 yet? If so, did anyone get the error "2337..... could not close file" when installing either DTS or Workstation tools? Everything else installed successfully, but useless with the wkst tools of course. Regards Immy ...more >>

Strange behavior of SELECTed data
Posted by Ram Kumar Koditala at 8/20/2004 4:03:03 PM
Pleas help, Thanks, Ram Kumar ------------PROBLEM---------------------------------------- I have a temporary table #t1 with 15 columns that gets the data from a table for the given criteria and stores. There are 2 UPDATE statements on #t1 First insert will INSERT the data to 6 columns to ...more >>

TRUNCATE TABLE equivalent in Oracle and DB2
Posted by Stefan Olofsson at 8/20/2004 3:25:41 PM
Hi Is there an equivalent for TRUNCATE TABLE in Oracle and DB2? /Stefan ...more >>

SP question
Posted by Tim Cowan at 8/20/2004 3:00:23 PM
Hi I had created an SP that looked like the following: CREATE PROCEDURE sp_lookupWebInquiriesEmail @EmailAddress VARCHAR(75) AS DECLARE @exist INT SET @exist = (SELECT InqID FROM dbo.tblWebInquiries WHERE EmailAddress = @EmailAddress) IF @exist IS NULL SET @exist = 0 ELSE UPDATE ...more >>

Stored Procedure
Posted by Paul Say at 8/20/2004 2:51:44 PM
I have a stored procedure that on execution updates various tables in a database. This procedure takes some time to run. When called from client applications(asp.net) the procedure causes the application to time out. What I want to know is if there is a way that stored procedure can be called...more >>

Converting float to varchar without messing up the value
Posted by Drew at 8/20/2004 2:45:24 PM
I have a excel file that was pulled out of a database that is across the state. When I imported it into SQL Server, the SSN field became a float datatype. The problem is that usually SSN's are like, 123-45-6789. This value however is like this 12345678900.0. I need to get this in the databas...more >>

Copying data between databases with diff structures
Posted by Aaron Prohaska at 8/20/2004 2:32:25 PM
I am trying to copy data from a denormalized table into a normalized set of tables and can't seem to figure out how to get the ManufacturerID from the Manufacturers table copied into the Frames table for a given frame record. There are four tables that I'm using WS1.dbo.Parts, WS2.dbo.Compa...more >>

Update, variable table names, and math
Posted by Mike Rawlings at 8/20/2004 1:52:05 PM
Strange situation: In a stored procedure, I'm trying to run an Update statement while passing the table name in as an input parameter. The only way I found to do this was to create a string containing the SQL I want to run, then execute it: CREATE PROCEDURE dbo.sp_Percents(@tname varchar(25), ...more >>

Having Count=0... Looks like a bug but I don't believe it.
Posted by David Walker at 8/20/2004 1:33:22 PM
I have a strange problem... This looks like a bug in SQL, but I don't believe that SQL can be broken. System: SQL 2000 Developer edition, SP3, on Windows 2000 Pro. I think the gist of this can be conveyed without the DDL, because the tables have lots of fields (and one of the source "tables"...more >>

subquery VS joining Table
Posted by Bobby at 8/20/2004 1:31:27 PM
Hi.... I see that we can get same data if we use subquery or joining table(ex: inner/right/left join). my Question is: When to use subquery and when to use "join" ? and the plus minus? Performance? Best Practice? Thanks.... ...more >>

newbie to indexes
Posted by psb at 8/20/2004 1:24:59 PM
I have never really needed indexes, although now that one of our clients added 35,000 person records along with a ton of new orders, I feel I will need to add indexes soon. A respected developer told me if the database performance is slow, "just add another index". Well, how do I speed up an "...more >>

SP question
Posted by student at 8/20/2004 1:24:27 PM
Hi, CREATE PROCEDURE dbo.proc_SP1 @FirstName VARCHAR (20) = NULL, @lastName VARCHAR (20) = NULL, @iage int = 0 as select fname,lname,age from table1 where faname = @FirstName, lname = @lastName, age>@iage Question: If the @firstname is not passed, @l...more >>

Physical and Memory Temp Tables?
Posted by Peter at 8/20/2004 1:19:02 PM
I have the following line of code in my stored proc and it works fine. CREATE TABLE @tblTemp(Hours tinyint NULL, Instance varchar(6) Null) I was told that this is a physical db temp table and I should use a memory temp table. I was given this, DECLARE @tblTemp TABLE ( [ID] [int] ID...more >>

Extended Stored Procedures
Posted by Vijayakumar at 8/20/2004 1:01:42 PM
Dear all, Does anyone knows how to write extended SPs in SQL Server 2000? Can I get sample projects for the purpose? Thanks in advance Vijayakumar ...more >>

CHARINDEX in reverse?
Posted by boyscout at 8/20/2004 1:00:24 PM
I need to pull off the characters of a string which follow the LAST instance of a space character in the string. For example, in the string 300 East Mill Way Boulevard I need to capture 'Boulevard'. I'll also need to strip it off in the next query. (If it isn't obvious, I'm breaking down ...more >>

Triggers question
Posted by JOEF at 8/20/2004 12:40:29 PM
Hi All, I have a table that sets up employee securities. there are check boxes on a form that when checked the value in the column is -1. I need to create a trigger that will not allow anyone to check certain boxes. (Or update the column from 0 to -1) Is this possible? Thanks, Joe...more >>

combine multiple rows into one column
Posted by JT at 8/20/2004 12:38:23 PM
the following select: select t1.status_id, t2.description, t4.description from tContract as t1 inner join tlkContractStatus as t2 on t1.status_id = t2.status_id left join tContractPendingReasons as t3 on t1.contract_id = t3.contract_id left join tlkContractStatusReason as t4 on t3.status_reas...more >>

Index integer vs. varchar
Posted by Joseph at 8/20/2004 12:35:24 PM
I work with an application that have a primary key, this is a key of the business and this is a varchar datatype. Several other tables have this primary key in yours fields. My question is if it's more fast and efficient to make a key numeric aditional in principal table with the other varch...more >>

call SP from ASP
Posted by shank at 8/20/2004 12:07:03 PM
I'm on a shared SQL server and my host frowns on DTS packages for security reasons. I want to schedule a stored procedure to run on a schedule. They recommend I call the SP from an ASP page. Then I can schedule the script from my control panel. What's the best way to do this? How could I get ...more >>

Novice questions
Posted by Jim Abel at 8/20/2004 11:44:40 AM
I have 2 questions. 1) When I DECLARE a varibale DECLARE @Numusers INT SELECT @Numusers = (SELECT COUNT(*) ...) Some code .... At this point I would like to desroy the variable and then later recreate it with another DECLARE line? 2) Is there some syntax that I can use to supress...more >>

sysdepends turn off?
Posted by Brian Henry at 8/20/2004 11:34:05 AM
when i run my sql script i get this Cannot add rows to sysdepends for the current stored procedure because it depends on the missing object 'BENESP_AddContractCountNewMonth'. The stored procedure will still be created. no mater how i organize the script i still get a message... is there an...more >>

Scripting database
Posted by Kenneth at 8/20/2004 11:13:33 AM
When I script my database from VB.net it make space line after RETURN in all stored proc. I hate that..... Is there any solution for this problem, or is there any better prog to script a whole database? //Kenneth ...more >>

Select from 2 tables
Posted by simon at 8/20/2004 10:35:29 AM
I have table order with ORDER ID. I have table products with Orderid and productID. Example: order: orderID ---------- 1 .... products: orderid productID -------------------------- 1 2 1 3 ..... I have always 2 produc...more >>

Unique Identifier
Posted by Tracey at 8/20/2004 10:21:06 AM
I need to update rows in a table that were added without a uniqueidentifier. In sql books online it says you can do an implicit conversion between char and uniqueidentifier (ive been making sure the char is hex:a- f and 0-9). I cannot get these rows with null uniqueidentifiers updated. T...more >>

Retreive [Reserved] from sp_spaceused in SP
Posted by Mike Kanski at 8/20/2004 10:13:40 AM
I need to retreive [Reserved] field from system procedure [sp_spaceused]. I need to retreive it in my stored procedure and assign it to a variable. Is there a way to do that? ...more >>

Finding out the underlying table.column behind view columns
Posted by Dave Merrill at 8/20/2004 10:10:00 AM
For SQL views, is there any way to find out the base table.column that each view column represents? (Of course there may be view columns that don't correspond directly to any table.column, but I need to find out this info for ones that do.) Background: We have our own metadata about tables and...more >>

Multiple RETURN values
Posted by Nikolay Petrov at 8/20/2004 10:03:27 AM
Is there a way to return multiple values from stored procedure using the RETURN command ...more >>

DBCC INDEXDEFRAG
Posted by Janet at 8/20/2004 9:45:07 AM
The easiest way to script defragment all of my indexes in a single table. The indexes are not static were we adding and deleting indexes from the table. DBCC INDEXDEFRAG (0,table_name,?) Thank You, Janet ...more >>

Stored procedure question
Posted by Nikolay Petrov at 8/20/2004 8:56:44 AM
I need to write a stored procedure which changes user password based on validity of his old password. My table with users contains this columns: UserID - int (unique) Username - nvarchar(20) Password - nvarchar(20) I can easy change the password by using: CREATE PROCEDURE dbo.ChangePasswo...more >>

Could not allocate space for object microfilmacion in database Dbsiab because ther PRIMARY FILE GROUP IS FULL
Posted by Luis Esteban Valencia at 8/20/2004 8:47:46 AM
I m atrying to import data from one table to another in differente servers and I got this error. Could not allocate space for object microfilmacion in database Dbsiab because ther PRIMARY FILE GROUP IS FULL ...more >>

Trigger and User Prevention?
Posted by John Rugo at 8/20/2004 8:34:22 AM
Hi All, I need some help with the following requirement: (pseudo code below) Create Trigger on Date_Field Allow only these two (or more) users the ability to UPDATE this field. Any help on this would be appreciated :) Thanks, John. ...more >>

Transaction Log
Posted by nh at 8/20/2004 8:13:27 AM
I have a DTS package which must append 30-40 Million rows of data from one table to another.. All I have at the moment is a DTS package with one 'Execute SQL Task' with an INSERT command... The problem is that the package fails because the Transaction Log runs out of space.. Is there ...more >>

Loop for INSERTED in trigger
Posted by Just D. at 8/20/2004 8:03:41 AM
All, How can we make a loop to work with every inserted row separately in trigger? We can get the number of rows using @@ROWCOUNT. What's next? WHILE, FOR? What's a correct syntax to retrieve a required ROW in this loop? D. ...more >>

Search that ignores special characters
Posted by David C at 8/20/2004 7:48:26 AM
I have an application that needs to search on insurance company claim numbers. Sometimes the number is entered with hyphens or spaces, for example 415-34 76543 and the special chars are not always in the same locations. I want to be able to search on 4153476543 and find a match. Any ideas? T...more >>

Script to be run on SQL Start up.
Posted by John at 8/20/2004 7:46:04 AM
I have a reporting server and I would like to set up some tables in the memory every time SQL Server restarts. Can some one point me to the right direction how to set it up. I know DBCC PINTABLE will do the job but I dont know how would I set it up so that when SQL Server is restarted eith...more >>

SQL Error Log
Posted by john at 8/20/2004 7:43:29 AM
I have transaction log backups scheduled at hourly interval and every time a transaction lod is backed up, it adds an event to the SQL Error Log. Since I have this schedule set up on 10 different databases, my SQL Error log looks nothing but like this: "Transaction Log is Backed Up". Is th...more >>

WHERE with column alais
Posted by Darin at 8/20/2004 7:42:16 AM
How come I can't do this: SELECT iitm_item AS c1 FROM icitem WHERE c1='poass8x1' It returns an error: Invalid column name 'c1'. I actually what C1 to be the return value of a function, and the use the where clause to specify a range of return values for the function. But, the function t...more >>

add column in particular order
Posted by San Kam at 8/20/2004 7:25:59 AM
Hello All, Is there any way to add column to the table in a particular position(after certain column) thru ALTER TABLE commnad or other SQL command I would appreciate the reply Thanks...more >>

Date functions
Posted by marwan hefnawy at 8/20/2004 7:02:31 AM
Is there an Equivalent function in MS SQL to the "DateSerial" function in VBA. i.e. if the day and month and year values are variables, How can I construct the full date in SQL. Thanks ...more >>

Query taking long time to execute
Posted by Akash Uday at 8/20/2004 6:55:28 AM
Dear Experts, I am running a SP on SQL 2000 (IBM Xeon dual processor server) . It is taking 2-3 minutes to execute when i am running it from query analyzer . But when i call this sp from VB application its taking 8-9 minutes . I am running same Sp on SQL 7 on same configuration machi...more >>

view
Posted by anonymous NO[at]SPAM discussions.microsoft.com at 8/20/2004 6:34:33 AM
Hi I have a view that includes two tabels. I have a new field in the view that should get the value 0 if a field in one of the table is NULL if not NULL the value should be 1. Anyone that can help me solve this?? /Anett...more >>

Extended Stored Procedures
Posted by Stevo at 8/20/2004 6:07:01 AM
I need to create an Extended Stored Procedure, but know little or no C++. Does anyone know of any good guides and tutorials that will give me a step by step account of how to use Visual Studio 6 to create an Extended Stored Procedure. I'm not too concerned about coding the functionality as ...more >>

Simple decimal question
Posted by Jessy at 8/20/2004 5:51:27 AM
For the SQL below: select 1/2 , col 1/col 2 where co1 = 12 col 2= 5 it should return 0.5, 2 respectively. However, my return is 0. How can I change to 1 or 2 decimal places in the SQL? ...more >>

SQL MAX(ID) WITH DELETE / INSERT
Posted by Mark at 8/20/2004 5:38:26 AM
How can I resolve a deadlock from Table with the identitycol. I have SQL Server 2000 Enterprise Edition with SP3A. The system I have is numerous processor computers. Computer1 executes select MAX(IDENTCOL) from A then Computer2 executes delete A from where MAX(IDENTCOL) both Computer...more >>

Does query optimizer use locking hints?
Posted by Palmer Eldritch at 8/20/2004 4:25:03 AM
Does anyone know if query optimizer (SQL Server 2000) care about cost of locking? The query analyzer shows the same execution plan (and cost) no matter what locking hint I use. I assume that there should be some difference between BEGIN TRAN SELECT * FROM Table WITH (NOLOCK) COMMIT and BEG...more >>

query help
Posted by John Bonds at 8/20/2004 3:05:42 AM
I have the following table CREATE TABLE ShipRate { ShipMethodNameID AS VARCHAR(20), OrderLimit AS SMALLMONEY, Freight AS SMALLMONEY } I am trying to design a query that would return the appropriate freight if I pass in an order amount. i.e. If the order was $50, then I want...more >>

Trigger help please
Posted by Paul in Harrow at 8/20/2004 1:49:02 AM
For date entry into the following table: CREATE TABLE [dbo].[tblFutureClassesSub] ( [LDUserName] [varchar] (35) AS NOT NULL , [CourseName] [varchar] (75) AS NOT NULL , [BigClassCode] [varchar] (25) AS NOT NULL , [ClassDate] [smalldatetime] NOT NULL , [Attended] [varchar] (35) AS NULL , [Num4C...more >>


DevelopmentNow Blog