Groups | Blog | Home


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 > may 2004 > threads for wednesday may 26

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

IndexScan+Filter =(implies)=> Better Index Possible?
Posted by Ian Boyd at 5/26/2004 11:24:36 PM
Part of one of my queries performs an index scan (generates 1.8M rows), and then filters that set (down to 61 rows). The plan text follows. My question is (because i just don't know) shouldn't an IndexScan followed by a Filter operation be able to be converted into an index seek? ...more >>


Paging
Posted by IPrincipal at 5/26/2004 11:05:35 PM
After searching for a while on the net I realized that paging in t-sql is one of the most debatable topics among SQL programmers. There are lots of different suggestions depending on the performance and usability but I couldn't find a document which lists all different methods and their pros & c...more >>

What is the eqivelant for the % RowType of oracle in T-SQL
Posted by Aparna at 5/26/2004 10:31:03 PM
Hello Friends Pls. help me in this. I want to convert the oracle procedure in the T-SQL. And i am stuck in converting the %RowType statement in T-SQL. Can anyonce suggest me how to do this?...more >>

How to use the Table Data Type
Posted by Aparna at 5/26/2004 10:31:03 PM
Hello Friends Please help me in my following queries 1. What is the Table data type in T-SQL 2. Where can we use it? (pls. suggest the syntax 3. Can the Table data type be a replacement for the %RowType in Oracle....more >>

Disk space used by part of a table
Posted by BritVic at 5/26/2004 10:03:44 PM
I'm using SQL server 2k on a shared server. I need to calculate, in realtime, the actual disk space used by a portion of my "Products" table (e.g. finding how much space is used by products belonging to a specific category). Can I retrieve this info from within a classic ASP/VBscript app? Any h...more >>

Defining global function in DTS
Posted by arun.cn NO[at]SPAM sonata-software.com at 5/26/2004 9:53:17 PM
Hi, As a ETL tool we are using DTS to load dimensions and measures. We have some ten packages with each having many tasks. There are some functions like FormatDate (in VB Script) which I have written and are required in alomost all the tasks. But I'm ending up in including the function in e...more >>

Left Outer Join with filters
Posted by Manoj Raheja at 5/26/2004 9:40:01 PM
Hello, I am trying to use left outer join with filters, USE pubs SELECT a.au_fname, a.au_lname, p.pub_name FROM authors AS a LEFT OUTER JOIN publishers AS p ON a.city = p.city WHERE p.pub_name='Algodata Infosystems' Go But due to some reporting tool restructions, the query is genera...more >>

using view to access 2 tables conditionally
Posted by toylet at 5/26/2004 8:48:53 PM
I have two tables, one for currently employed hostess (ACTIVE_HOSTESS) and another for resigned hostess (RESIGNED_HOSTESS). Both table has a field ID_NO as the key to each hostess. Now using @ID_NO as a search key, look for record in ACTIVE_HOSTESS; if not found, look into RESIGNED_HOSTESS. ...more >>



basic error routines for a novice
Posted by bullrout NO[at]SPAM hotmail.com at 5/26/2004 8:16:16 PM
Hi There, I am very new to SQL Server and would like to know somw syntax for basic error routines if possible? Also is it better to have an error routine in each stored procedure and use try / catch in the page or a combination of both? Sean - thanks in advance CREATE PROCEDURE Custom...more >>

Date Difference without weekends
Posted by Sergio at 5/26/2004 8:11:02 PM
Hi all! Im trying to get a query that brings me the difference between two dates but ONLY LABOR DAYS ie Today is May, Wednesday 26th and the target date is Friday Jun 4th. an I want to get th difference without Saturday and Sunda Thanks in advanced Sergio...more >>

Nested Transactions - again?
Posted by Mario Splivalo at 5/26/2004 6:46:14 PM
I browsed trough newsgroups, esp this one, found a lot of info about transactions, but I still have some doubts. So, can I pull something like this: I have this, 'main' procedure: CREATE PROCEDURE mainProc AS BEGIN TRANSACTION <do_some_work> EXEC workProc <do_some_more_work> IF <some...more >>

Create Function with Parameter input
Posted by Harry at 5/26/2004 6:26:03 PM
Can someone help with this creation? I am trying to take a parameter input value as a from variable. I am getting an error as @InputTable not defined. ??? CREATE FUNCTION EmployeeIDCheck (@InputTable varchar (50)) RETURNS Table A Return (Select * from @InputTable Where EmployeeID = '9999' ...more >>

How to retrun one day before and one day after an specific study
Posted by Reza Alirezaei at 5/26/2004 6:17:50 PM
I have a query as follow: SELECT CONVERT(char(10),EndedDateTime,104) as DateCompleted FROM MYTABLE I want when there is one record this statment retrun one day before and after that ,,for istance if there is only one record in mytable like 2/3/2004,the query returns 2/2/2004 2/3/2004 <-...more >>

datetime filter in SPROC
Posted by Scott at 5/26/2004 6:04:43 PM
I have a SPROC that I want to pass a single date variable like 5/24/2004 and return records from 5/24/2004 5:30 AM to 5/25/2004 5:29.59 AM. FIGURE 1 runs find with datetime hardcoded in the WHERE clause. I need help building my where clause in FIGURE 2 so the SPROC concatenates the 5:30 AM and...more >>

select statement to find circular references?
Posted by Jim Bancroft at 5/26/2004 5:46:20 PM
Hi all, I have a table with (among others) two columns in it-- an ID field, and a "parentID" field. We use this table to draw a folder tree on our web pages. Sometimes we run into a problem where the child accidentally becomes the parent to *its* parent, creating a bit of a circu...more >>

Access Violation after upgrade to SQL 2000 sp3a
Posted by greg.davies NO[at]SPAM thomson-removeme.com.au at 5/26/2004 5:42:41 PM
Just upgraded from SQL Server 7.0 Entperprise Edition to SQL 2000 EE sp3a using an inserver upgrade. Windows 2000 Adanced Server SP3. Everything working OK with hundreds of users attached except for intermittent Access Violation - see dump below. I cannot reproduce the problem but I sus...more >>

Return Value from storedprocedure not working
Posted by sean at 5/26/2004 5:11:51 PM
HI there, I am trying to test a return value from a stored procedure, I pass 3 parameters in and I want to return an error message if the username already exists in the database, what am I doing wrong? Sean - Thanks in advance for your answer !-- stored rocedure CREATE PROCEDURE Custo...more >>

"Syntax error converting the nvarchar value '...' to a column of data type int."
Posted by JoeTart at 5/26/2004 3:06:02 PM
I upsized an Access 2000 dB to SQL Server 2000 I am trying to filter records from one table [Exams] in a "CustomID" field from another table's "CustomID" field ([CustomInfo] table) Before I upsized, I was using the fileds as "text". After upsizing, they are now "nvarchar" The primary key in Cus...more >>

Case Order by problem
Posted by Lasse Edsvik at 5/26/2004 3:03:40 PM
Hello I pass a char-variable @Order and it doesnt work if column is datetime....... SELECT ......... ORDER BY CASE @Order WHEN 'SUBJECT' THEN S.Subject WHEN 'USER' THEN U.Firstname WHEN 'DATE' THEN Q1.Datecreated END I get: Syntax error converting ...more >>

Stored Procedure for Searching Table
Posted by Nik at 5/26/2004 2:57:35 PM
Hi folks, I am having a unique problem here. I have this table where I am storing information in 3 columns: * Question - Stores questions submitted for review * Keyword - Stores keywords entered by expert * Response - Stores reply entered by expert I want to do a search on this table on ...more >>

caculate percentage
Posted by JT at 5/26/2004 2:54:30 PM
select round(((1.0 * t2.TotalCanc) / t1.NewAcc), 4) * 100 as 'Total%' returns 34.690000000000 how can i get it to just return 34.69??? ...more >>

job stuck at perform completion action step
Posted by JJ Wang at 5/26/2004 2:51:21 PM
Hi, I have a job on sql 7 server that stuck at 'perform completion action' step after we stopped the job. Is reboot the server the only choice to fix it? many thanks. JJ...more >>

question on datatype smalldate
Posted by Tin at 5/26/2004 2:39:56 PM
i'd like to use smalldate as datatype for version validation but don't know how to use it. can someone help me with this or point me to where i can do some reading? thanks tin ...more >>

Slow Query: parts of dates and times...
Posted by Ian Boyd at 5/26/2004 2:23:21 PM
Here is the overview of the situation. A bus arrives at a certain time, and is slotted to park in a certain Bay (i.e. parking spot). Each bus allocated to that Bay for certain time period (i.e. 15 minutes). A Reservation is a bus arriving at a certain time, using a specific bay. My query is...more >>

BOL incorrect? - FOR BROWSE??
Posted by Woogon at 5/26/2004 2:16:04 PM
Hi all I'm new to SQL, so please forgive me if this is an elementary question I've been having trouble doing positional updates and deletes using a cursor. I checked out BOL and it said "Before a cursor can be used by a positioned UPDATE or DELETE statement, the SELECT statement in the cursor...more >>

IF statement in Computed Column
Posted by dalekahn NO[at]SPAM hotmail.com at 5/26/2004 2:00:46 PM
Sql Server 2000. Is it possible to use a nested IF statement (or even an unnested IF statement)when defining a Column Formula, such as: IF(Funding_Type="FED",[2004 Hours]*22.50,(IF(Funding_Type="ST",[2004 Hours]*21.24,(IF(Funding_Type="CITY",[2004 Hours]*21.75))))) Thanks, Dale Kahn...more >>

Strange results
Posted by Stijn Verrept at 5/26/2004 1:27:28 PM
I have the following procedure: declare @BeginDate SmallDateTime declare @EndDate SmallDateTime set @BeginDate = '2004-05-01' set @EndDate = '2004-05-31' select CL.caldate, (select count(*) from seniors inner join permissions on PE_SNID = SN_ID and PE_PLID = 1 and PE_Begin <= CL.caldate ...more >>

Money formatting (Help please, in a rush)
Posted by KT at 5/26/2004 12:57:58 PM
Why doesn't the convert style method work. The ",1" in the convert statement below is suppose to convert the 1000 to 1,000.00 Thanks in advance. declare @gift as char(15) set @gift = '1000' select convert(money,@gift,1) ...more >>

Finding number of rows without using COUNT(*)
Posted by Simon at 5/26/2004 12:42:38 PM
I am writing a job to update statistics on my database (yes, I know about auto stats). For very large tables (over 1 million rows), I'd like to use a larger sampling than for small tables. Here is a code snippet (@table_name is filled in earlier in my script): if (select max(rows) from sy...more >>

stored procedure parameters
Posted by george at 5/26/2004 12:26:06 PM
I have the following SP for which I am trying to establish new records in three tables: Facility, Address, and the connecting table FacilityAddress. I call this from ADO code but get an error message that I am not supplying the NewAddressId or NewFacilityID. But I am generating those values from thi...more >>

Update trigger always uses last record
Posted by Nate C at 5/26/2004 12:05:02 PM
I have an update trigger that uses the "IF Update (column)" function. The trigger sends out an email containing some information from that record. When an update is made to that column of ANY record, for some reason, the trigger always fires on the last record in the table even though th...more >>

error: text pointers are allowed in work tables
Posted by Nikhil Patel at 5/26/2004 12:03:56 PM
Hi all, I am getting the following error on an insert query. Because the script is too large and the query is complex, I tried to reproduce the error on a simpler script written to test it and post it here. But I did not get an error in the test script. "Only text pointers are allowed in ...more >>

Select with Insert
Posted by Daniel Jorge at 5/26/2004 12:02:34 PM
Hello there, I'm having the following trouble and I hope somebody can help me. I have a table with the Key field as a Identity Field [auto increment] and, at the same time I'm inserting a new Value in this table, I want to use this ID field. The "INSERT INTO " then "SELECT MAX(K...more >>

insert big config text file into sql
Posted by Tin at 5/26/2004 11:55:59 AM
is it possible to store a text file in sql db? i wanted to store my firewall config (either just content or text file) in mssql db so i can retrieve/update from query gui. thanks ...more >>

How To build a cursor select with data passed to a stored procedure
Posted by mcsmith at 5/26/2004 11:50:50 AM
I would like the 20000 in the SELECT TOP statement below to be passed into the stored procedure and to be used inside a declare cursor. I have been unable to do this using by passing a variable, declaring a variable or putting the entire select statement in a string. Of course it works outside ...more >>

Uniqueidentifier storage
Posted by Ilya Margolin at 5/26/2004 11:50:08 AM
Hi All, I've used uniqueidentifier extensively as a clustered primary key column data type. I've seen a lot of discussions whether or not GUID ought to be used as a primary key. Despite to the notion that it takes whole 16 bytes I am satisfied with the general query performance on a 6GB+ datab...more >>

get IDs after an insert
Posted by Amadelle at 5/26/2004 11:45:55 AM
Hi all and thanks in advance, I was wondering what is the best way to find out the ID's (Identity fields) of a batch insert into a table right after inserting? So that I can only select the rows just inserted. by immidately after an insert I mean in the same stored procedure and the next comm...more >>

Forcing a Trigger after a insert of several records
Posted by Jim Abel at 5/26/2004 11:16:18 AM
Is there a way to force a Insert/Update trigger to fire after an insert or update of several records? I'm redeveloping a application where the records used to be Inserted one at a time and the trigger executed fine. The redesign inserts or updates several records at a time and the trigg...more >>

DELETE Trigger that will only allow cascading deletes
Posted by Scott Lyon at 5/26/2004 11:12:10 AM
I've got a problem. I have a table that mysteriously has had data deleted from it. So I figured I would put a trigger in place to force it to not allow deletes. The exception, is if the record is deleted as part of a cascading delete. Unfortunately, I cannot figure out how to code this. T...more >>

Strange Enterprise manager Error
Posted by martin at 5/26/2004 11:08:13 AM
Hi, Recently when creating/altering (mostly altering) tables in any database on a particular server that we have I have been getting the following error 'tlkpRegion' table - Unable to create index 'PK_tlkpRegion'. ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid cursor state Origin...more >>

Recursive Trigger
Posted by Jason MacKenzie at 5/26/2004 10:51:08 AM
I have a simple update trigger that updates a table. I need to turn on recursive triggers for another one I'm working one. Obviously the first trigger is going to recurse until the nesting level is exceeded. How can I resolve this? Thanks a lot, Jason ...more >>

Formatting a DECIMAL column to a fixed width
Posted by sdluu NO[at]SPAM sunocoinc.com at 5/26/2004 10:33:16 AM
Hello All, I need some help in formatting a decimal column I have in my SQL DB. The column is called RATE, DECIMAL precision=8 scale=5. How can I write a SELECT statement that will return this column to a fixed width with zeroes padded to left and/or right. For example, value in DB n...more >>

time out (used to work fine and was indexed)
Posted by mike at 5/26/2004 10:24:35 AM
thanks for any help with this. i have a vw that used to time out. i used the index tuning wizard in query analyzer to create an index on one of my big tables (2M records) and everything worked great thereafter. when i run the views now, it times out. when i try using the index tuning wizar...more >>

Left anti semi join (!)
Posted by myname at 5/26/2004 10:24:05 AM
Hello, I'm using SQL Server 2000. I'm trying to write what the help file calls a "left anti semi join", that is to return all the lines from the left table that do not match any in the right table. The only way I found to write that is something like : select * from T1 left join T2 on...more >>

Performance Concern
Posted by wlansing NO[at]SPAM rlcarriers.com at 5/26/2004 10:13:36 AM
All, I am kicking the first part of a rather complicated ETL process off by loading a flat file into a Import table. At some point I must convert the some of the data from the char data type that is imported as, into int, money, and a few other data types. The question then becomes, do I do...more >>

debugging sql code whit in visual studio.net
Posted by reza at 5/26/2004 10:11:03 AM
Hi every body .... I have developed a projet ( windows application ) whit visual studio .net ( vb) and sql 2000 ( desktop edition ) when I want to debug my VB code I set a break point and run my program ...It stops at my breakpoint and it works well .. but I want to debug my sql code whitin my vi...more >>

Repost of Identifying Contiguous data block
Posted by jnc at 5/26/2004 9:56:02 AM
First of all apologies for posting this message again, reason i am posting again is because it was extremely close to being answered last time and would just like to but it back on the radar Basically my question was I am trying to identify a way a grouping data into contiguous blocks, for exa...more >>

OpenXML WITH table-name and identity column
Posted by Doug at 5/26/2004 9:34:25 AM
We are passing XML to a Stored Procedure. We are trying to use the OpenXML ....WITH table-name One of the columns coming in for an UPDATE is one that is an Identity column. We are having problems saving the Stored Procedure. The error is Error 207: Invalid column name 'QM_ID'. ...more >>

Which DataType to use to store text and be able to search it.
Posted by mitchel at 5/26/2004 9:26:50 AM
Hi, I am adding a MEMO function to our system and was wondering which DataType is best to use to store the text and still be able to search it via an ASP/SQL form? I was under the impression that you could not search certain DataTypes? The memo fields will not be holding huge amounts of te...more >>

Script for Stored Procedure or User-Defined Function for SQL Server
Posted by Matt Kisasonak at 5/26/2004 8:31:11 AM
Hi Y'all I am new to these two types of objects and can use some help getting started. I need script that will take any letters off the end of a text strings like 2000-020A to return 2000-020 and then search a table to count the number of records that contain this string in a particular colu...more >>

User table with encrypted passwords?
Posted by Luis E Valencia at 5/26/2004 7:31:25 AM
I have this on ASP, the member signs up with this code. Set Conn = Server.CreateObject("ADODB.Connection") Conn.open strconn login = Trim(request.form("login")) 'password= Cstr(EncryptString(Trim(request.form("password")))) Randomize RandomNumber = Int(Rnd * 100000) + 1 activac...more >>

Sql File
Posted by Carleto at 5/26/2004 6:41:03 AM
Hello I have an SQL file with several SQL commands I want to execute this SQL File from Query Analiser without open it Can i use some SQL command to do it Please Help Thank you......more >>

Identifying Contiguous data blocks
Posted by jnc at 5/26/2004 6:16:09 AM
Hi Everyone Was wondering whether anyone could point me in the right direction. I am trying to identify a way a grouping data into contiguous blocks, for example say I had the following table with one column and the following values Valu 1 What I would like to be able to do i...more >>

HELP, Financial Schema
Posted by Brian at 5/26/2004 5:49:18 AM
Howdy all, I know relatively nothing about financial database design (which is eveident from my own checking account management). Is there a place where one can download example schemas of financial/billing/receipt type systems. The simpler the better. Thanks. Brian...more >>

backup with truncate_only
Posted by mike at 5/26/2004 5:31:06 AM
Hell What is the correct syntax for backing up the transaction log with truncate only option to a mapped drive on the network I tried BACKUP LOG DB_NAME TO DISK='F:\TRANSLOG' WITH TRUNCATE_ONLY and I got a syntax error Thanks a lot!...more >>

transaction log
Posted by mike at 5/26/2004 5:11:06 AM
hell I tried shrinking the transanction log file, first I used bcc opentran and there were no open files, than I tried dbcc shrinkfile (logfilename, 2) and I got the message that I cannot shrink the file as all logical files are in use!!! How come nothing showed up in dbcc opentran?...more >>

Updating IDENTITY
Posted by Peter at 5/26/2004 3:51:54 AM
Dear All, Due to reasons too long to explain our identity columns are getting out of sych. Using the command SELECT name from sysobjects where xtype = 'U' i would like to loop though all my tables and update the internal value (not the one on the table but the one held if you do a IDEN...more >>

T-SQL Problem
Posted by Sheetal at 5/26/2004 3:16:02 AM
Hi I'm using the following query..however, it doesn't show me "all" the unique keys only when i use the 'where' condition(but includes all the pk and fk's as well) and i'm forced to use the Like condition..Am I doing it right? --lists all the unique constraints of the database and the columns on ...more >>

Whether to use Triggers or StoredProcedures in SQL 2000...
Posted by Clive Crocker at 5/26/2004 1:56:05 AM
H I guess there is no absolute answer to this question but here goes... I am building a 'tracking system'. It tracks movement and usage of stock items (at this stage) and I need to maintain movement / usage history and 'current' stock levels I am consideing 2 alternative ways to implement the up...more >>

Develop (extend) Enterprise Manager MMC
Posted by Artur at 5/26/2004 12:14:00 AM
Hi, I'd like to extend my EM MMC and add new functionality. Is it posible - if yes how to do this. New option in Context Menu. Best regards Artur ...more >>


DevelopmentNow Blog