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 > december 2004

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

queries Vs Stored Procs
Posted by Nickl at 12/31/2004 9:43:02 PM
I often use a chain of queries to produce a final output. Eg to prepare aggregate data, or to set up generic queries which are then used in many other queries to simplify things. My question is this; how much advantage performance wise will I get if I make those sub-queries stored procedures...more >>


Loading a set of Records
Posted by Gopinath R at 12/31/2004 6:10:35 PM
Hello All, I have a Table named DVDVideo in the Stage database (StageDB) as well as in the Production DB (VideoMediaDB). On a weekly basis, the data have to be moved from StageDB..DVDVideo to VideoMediaDB..DVDVideo. In StageDB..DVDVideo, one can find the following types of records : [1]...more >>

Cursor operations
Posted by Andrew Clark at 12/31/2004 5:23:58 PM
Hello, Suppose the following: DECLARE test CURSOR FOR SELECT nameID, firstName FROM testing DECLARE @array TABLE ( nameID INT NOT NULL, firstName VARCHAR(32) NOT NULL ) DECLARE arrayCursor CURSOR SCROLL FOR SELECT nameID, firstName from @array DECLARE @index INT, @count I...more >>

Can Indexes effect Bulk Insert/Update Operations
Posted by Siz at 12/31/2004 5:22:58 PM
Hi, I have a suspicion about using Bulk Insert/update on indexes tables whether they bogged down performance or not. Or dropping indexes and/or constraints at start of bulk operation and then creating them again at the end will help or not ??? Can Indexes effect bulk insert and update opera...more >>

True or False question.
Posted by Miguel Dias Moura at 12/31/2004 3:13:57 PM
Hello, On a users table I have a field which indicates if the user is authorized or not. Is there a Boolean type in SQL database 2000 or should I use integer type? What is usually used? Thanks, Miguel ...more >>

How to edit a Microsoft SQL database online?
Posted by Miguel Dias Moura at 12/31/2004 3:04:36 PM
Hello, On a web site I manage I have a Microsoft SQL database. As administrator I would like to easily edit, access, delete, add any record in the database tables while the database is on the server where I host my web site. Is there any software to do this? Something like Enterprise...more >>

Happy New Year to All
Posted by Pike at 12/31/2004 2:52:20 PM
In case you haven't noticed:) ...more >>

where would be ideal location for tempdb and translog?
Posted by === Steve L === at 12/31/2004 2:32:30 PM
sql2k. i've read it some where that transaction logs and the TempDb should be place on a RAID 1 (mirror) drive. I have two questions about the statement: 1. is it only limited to transaction logs? can log files (ldf) benefits from the same idea? 2.how can I move a tempdb out of its defau...more >>



Summarizing data, grouping by time period.
Posted by Nevyn Twyll at 12/31/2004 1:44:01 PM
I have a table of student incidents, including absences from school, listing the student ID, the date of an incident, and whether it was an absence. I want to get a result set from this table showing me ON ONE ROW, the studentID, and the absences split up by term. Table: [Incidents] Perti...more >>

error in executing SELECT statement
Posted by Dzemo at 12/31/2004 11:55:09 AM
I get this message when executing SELECT statement in SQL 2000: Location: recbase.cpp:1374 Expression: m_nVars>0 S PID: 51 Process ID: 2480 Why? Any help? ...more >>

SQL 2000 slowness
Posted by yung.robert NO[at]SPAM northropgrumman.ca at 12/31/2004 11:12:32 AM
Hi, I have a very strange problem. I have one sql 7.0 box, and one sql 2000 sp3 box. An ASP app that we've been running off of the 7.0 is now running about 10x slower on the 2000 box. The 2000 has more ram, faster processor, and both are running on WinNTsp6a. I have checked all the possib...more >>

How to rethrow errors from catch block?
Posted by Alexander Jerusalem at 12/31/2004 4:45:06 AM
I was hoping for a more streamlined error handling now that we get try-catch but I seem to be running into a few problems. One very important idiom with try-catch is to first rollback the transaction and then rethrow the original exception in the catch block. How can I do that for system error...more >>

DATEADD Command
Posted by Robert at 12/31/2004 4:33:01 AM
Hi, I Have the following bit of SQL in a stored procedure: SELECT DISTINCT ref FROM U_NFADHOC WHERE CONVERT(DATETIME,DATE) BETWEEN DATEADD(MONTH, -12,CONVERT(DATETIME,@enddate)) AND CONVERT(DATETIME, @enddate) AND RESPTYPE='NF Cash Donation' Currently (as I hope you can see) it is ...more >>

stored procedure error
Posted by Robert at 12/31/2004 2:01:02 AM
Hi Would it be possible for someone to check my code for the stored procedure shown below. I'm passing a date parameter into it, and then checking that the donor has made at least one payment every year from the parameter date. It did work when I first ran the query, but now it's coming up ...more >>

Import / Ordering / Script File
Posted by Rob Meade at 12/30/2004 9:41:35 PM
Hi all, I've been having problems with an over night job since the 20/21st December, basically the import had been failing because of a problem with a view. Turns out that SQL Server wasn't able to determine which views should be created first, ie, which are dependant on other views - as a r...more >>

Saving Attachments using XP_Readmail
Posted by Brent C at 12/30/2004 9:33:03 PM
Hello, I am trying to run the XP_READMAIL Procedure with the intention of saving the attachments of the emails to the Temp Directory, the process runs ok, however I cannot find the attachments it has saved. I have looked in the Temp folder, but they are not there, I have even searched the ...more >>

BULK INSERT
Posted by Mike Labosh at 12/30/2004 8:20:50 PM
I need to import a delimited txt file. All values have double-quotes around them and are delimited with tabs as in: "value"[Tab]"value"[Tab]"value"[etc][CRLF] Here's what I have so far in my stored procedure, and I'm having trouble phrasing the BULK INSERT to handle the quotes: SET @sql...more >>

SQL Server Instance
Posted by Leila at 12/30/2004 6:22:23 PM
Hi, How can I determine that if user has installed SQL Server or MSDE on his machine before starting the installation of my app. Thanks in advance, Leila ...more >>

ITS FASTER, I JUST DONT UNDERSTAND WHY
Posted by Rex at 12/30/2004 5:48:16 PM
I have a clean up project to delete a hundred million rows (from a table of 300 million) that are stale. These rows are children of about 500 parent rows in another table. If I do this: /**BEGIN EXAMPLE 1 SLOW**/ set ROWCOUNT 50000 -- So I don't blow up the log declare @int int select @...more >>

Operation is not allowed when the object is closed
Posted by Conax at 12/30/2004 4:46:22 PM
Hello! Error Message: "Operation is not allowed when the object is closed." What I have is a stored procedure on SQL server that goes and checks data on a table and populates a temporary table (declared within the stored procedure) with record ID and description of invalid records. At the en...more >>

Can this actually be done?
Posted by Rob Meade at 12/30/2004 4:15:18 PM
Hi all, I've spent all day now looking into these Linked Servers, and I'm completely bu**ered if I can see anyway of creating a view in one of my databases on one server to get data from a table in the other server... I've tried all sorts of combinations, I've tried it on different servers...more >>

select from a storeprocedure
Posted by Carlo at 12/30/2004 4:09:27 PM
hi i need to SELECT id FROM my_store_procedure how can i do?? carlo thanks...more >>

to bit or not to bit thread -- where located ?
Posted by John A Grandy at 12/30/2004 3:04:01 PM
did someone move the thread "to bit or not to bit" to another newsgroup ? ...more >>

Self-referencing query?
Posted by Willie Bodger at 12/30/2004 3:01:18 PM
If I have a table of customer products (let's say product A is a trial and Product B is a full version), how would I write a query that would pull perhaps everybody that has Product A and not Product B or both A & B etc.? I'm sure this is a simple logic that I'm just having trouble getting a g...more >>

need help on error msg
Posted by TJS at 12/30/2004 2:53:34 PM
need help resolving this concatenation error Microsoft OLE DB Provider for ODBC Drivers (0x80040E07) [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '41670 test' to a column of data type int. for strSQL = "SELECT categorycode AS Category , PostC...more >>

condensing a range of numbers
Posted by sg at 12/30/2004 2:50:50 PM
Could somebody point me towards some example cursor code that takes a list of numbers: 1, 2, 3, 5, 7, 8, 9 and formats it into a range of numbers: 1-3, 5, 7-9 Thanks. My initial attempt is below. It's close, but not quite. declare @seat_str varchar(4000) select @seat_str = '' ...more >>

Cursor Fails After First Successful Run
Posted by Garibaldi at 12/30/2004 2:04:21 PM
The first time the following script runs, it successfully updates permissions. Even if I change the database, the script fails the second and each time thereafter. I need to close the scipt and reload it into query analyzer for it to run. What am I doing wrong here? Or, am I missing some...more >>

Novice: retrieving message headers
Posted by Malcolm Miles at 12/30/2004 1:49:47 PM
A question from a SQL novice. I have a database that contains 10,000 or so message headers. Database fields are: msg_id msg_date msg_subject msg_body I want to retrieve a message using its msg_id and then display a link to the next and previous messages in date order. Obviously I ca...more >>

Sub Query
Posted by DaveF at 12/30/2004 1:42:06 PM
Don't blame me for this table. I am just trying to code on it. The Table has 5 fields in it. I have an resultid, questionID, OptionTextboxValue, SurveyResultID, OptionID The table hold 3 question results from a form. FirstName, email and the third question has an optionID of 1566 or 1577. 15...more >>

Query Analyzer / Default Database
Posted by Mike Labosh at 12/30/2004 12:45:02 PM
Every time I startup Query Analyzer and connect a session to the database server, it always by default connects to a certain database. I would like it to, by default, connect to a different database, but I can't find anything in the options dialog for this. Where else should I be looking? ...more >>

Query in Infinite loop?
Posted by tarheels4025 at 12/30/2004 12:25:04 PM
Here is my query and it is taking forver to run. Is it in an infinate loop or no? Thanks for an answers. Use WinPayment GO SELECT pos_condition_code, convert(char(11), retrieval_reference_number) RR, message_type, authorization_identification, convert(char(8), card...more >>

Array Question
Posted by Jm at 12/30/2004 12:15:41 PM
Hi all Im sure there is an easy way to do this but im not quite sure what to do. I have a stored procedure that up until now would recieve a no fixed length string that contained id numbers of 3 characters and a # symbol to signify the end of the number. Now these id's are always 3 numbers lon...more >>

Data from two different databases
Posted by John Baima at 12/30/2004 12:11:50 PM
I'd like to do a select like: select emp_email from company1.tblEmp e where not (e.emp_email in (select emp_email from company2.tblEmp)) company1 and company2 are different databases in the same SQL Server. Can this be done? Thanks. -John ...more >>

Sql Server Performance Question
Posted by Jm at 12/30/2004 12:00:59 PM
Hi all Im just wondering which approach is quicker for sql server to process from a stored procedure with this data. Say i have a two column table, first column is machinename, second column is appid. Is it quicker for sql to proccess a select statement if i have a seperate row for each machin...more >>

BCP question - any way to have a comma delimited, quoted columns?
Posted by Eric at 12/30/2004 11:34:22 AM
I need a CSV output file with the columns themselves surrounded by quotes. I've tried -c -t"," which gives me the commas, but have not yet found a combo that gives me quoted values as well. I also tried -c -t""" which gives me quotes but not commas except at the beginning, and -c -t"","" didnt w...more >>

create database in VBScript
Posted by merre at 12/30/2004 11:21:02 AM
Hi! Is it possible to create an database in SQL Server generated in VBScript?? Kind Regards Mehran...more >>

Converting NULLS to Zeros
Posted by Chris at 12/30/2004 11:19:10 AM
Hello, Is there a function to convert NULL values to zeros so that they can be used in arithmetic calculations? Any help is appreciated for this newbie. Thank you! Chris...more >>

Problem with DMO.Index Type Property
Posted by Martin Schmeller at 12/30/2004 11:10:16 AM
Hi everybody! I get the error "Invalid Index Type" when I try to set the Type Property of the DMO Index-Object: When I copy a table, I also want to copy over all the indexes. I iterate over original table's Index collection, grab each index and try to re-create it in the new table. I skip ind...more >>

Need some assistant with tough query please.
Posted by Lam Nguyen at 12/30/2004 11:03:05 AM
How can I get the result show below. The rules also showing below. Any help would greatly appreciate. Thank you in advance. IF OBJECT_ID('Tempdb.dbo.#Prospect', 'u') IS NOT NULL DROP TABLE #Prospect GO CREATE TABLE #Prospect ( Person_id INT NULL, MFPolicy_nb INT NU...more >>

order by problem
Posted by zapov at 12/30/2004 10:57:02 AM
Hi I want to read data from table sorted by int data type But, value can also be null, so when I try to read it sorted ASC, a get nulls first, and I want them to be last I searched on the net a little, but came out emptyhanded. How should I write these query properly SELECT * FROM Tabla O...more >>

Partioned views /update/insert issue
Posted by Abraham at 12/30/2004 10:43:04 AM
I have a partioned view called members. Partined based on status of the members. Tables : members_11 ( check status=1) members_22 (check status>1) primary key ( memberid , status) View: members -- create view members as select * from members_11 union all select * from members_22 Th...more >>

adDate parameter to stored proc.
Posted by Agoston Bejo at 12/30/2004 10:01:39 AM
Hi! I am trying to pass a VBScript Date variable as value to an ADO adDate parameter of a stored procedure (which runs in an SQL Server). If I add the parameter like this: oCmd.Parameters.Append oCmd.CreateParameter( "@p_Date", adDate, adParamInput, , dParam) where oCmd is of type ADODB.Co...more >>

Trigger -> Create Database
Posted by Preston at 12/30/2004 9:33:09 AM
Is there any way to get around the prohibition of 'create database' statements in triggers? What I'd like to do, ideally, is have an insert trigger that fires and creates a database and then populates it with tables from a template db, i.e. create trigger blah after insert as create datab...more >>

Linked Servers?
Posted by Rob Meade at 12/30/2004 9:18:22 AM
Hi there, Hope everyone had a good Christmas :o) So, linked servers....here's the problem... We have 2 SQL Server 2000 (running Enterprise Edition) in a SQL cluster - this is known as AvonSQL. Recently this has become over loaded, so we bought another server to run as a seperate SQL ...more >>

DTS import duplicate records staging table
Posted by AshleyT at 12/30/2004 8:25:06 AM
I currently have a process where I get zip files with dbase tables. I then take the dbase tables and import them into a staging table. The issue is that the process to create the zip files can easily create duplicate dbase tables. Which then the dts process stops because it violates the pri...more >>

Error 213
Posted by Robert at 12/30/2004 8:05:04 AM
Hi, I am in a terrable mess! I would really appreciate a hand. I am in the process of developing a program which has a number of stored procedures. There is a main input date which i then 'hope' to pass through to the various stored procedures. If i run it once it seems to work fine. If i t...more >>

Intermittent SQL Dump Exception...
Posted by Robert Taylor at 12/30/2004 7:22:06 AM
I have a batch job that runs daily but is intermitently failing. The job seems to complete okay, but SQL catches an Exception during the execution and marks the batch job as failed. I've looked in the logs and found the following entry each time the failure occurs. I have a SQL transaction l...more >>

REAL/DOUBLE PRECISION
Posted by Justus at 12/30/2004 2:03:03 AM
Hi We had some problems with the precision of large incomes in a swiss social security application using SQL Server 2000. So I did some tests: SQL SERVER 2000 Float Precision MS-Help says: REAL: FLOAT(1) .. FLOAT(24) 4 - Byte Float with 7 - dig...more >>

Date conversion from Oracle to SQL Server
Posted by zambetti NO[at]SPAM inwind.it at 12/30/2004 1:35:05 AM
Hi all, I have a problem with a conversion from some functions in Oracle to SQL Server (T-SQL). The functions are: to_char(time, 'dd-mm-yyyy hh:mi:ss'), to_char(time, 'dd-mm-yyyy') to_date(times, 'dd-mm-yyyy'); to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')); where "time" and "times" are...more >>

Sql To Active Directory Quickie
Posted by Jm at 12/30/2004 1:06:21 AM
Hi all Im not sure if this is possible, but im sure ill get the answer here. In SQL Server is it possible to create a stored procedure that will take a username supplied by you and check the active directory account for that user and find what active directory groups the user is a member of, a...more >>


DevelopmentNow Blog