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

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

Backup/restore/maintenance multiple databases
Posted by tom.nys NO[at]SPAM agfa.com at 6/28/2004 11:52:44 PM
Hi, Our software uses 6 databases, each having 2 tables. We have a ReplicationService, which makes full/incremental backups on a regular time interval. Below is the sequence of commands which are being executed during full backup (sequence is executed for each database): USE <db> DBCC SH...more >>

Urgent help Needed - Please Read
Posted by Rajib Chatterjee at 6/28/2004 11:24:29 PM
Hi All, If we change the System settings to Swedish(Finland), the decimal space is a Comma "," instead of a Dot "." Now the problem is SQL Server does not recognize this and gives error. We can not do collation setting for numeric fields also. Any help on the same will be highly appreciated...more >>

Find and Replace
Posted by rob at 6/28/2004 11:02:49 PM
I need to do a Find and replace exercise throughout a database... all Supplier numbers are changing. It is easy enough to do the replace... it's the finding that is somewhat difficult... they did not always call the column 'Supplier'... they also embedded the Supplier code in some notation col...more >>

Good Book?
Posted by NathaN at 6/28/2004 7:51:12 PM
Hi, I'm just getting started with MS SQL Server 2000, and I'm looking for a good book. Can anyone recommend a comprehensive and comprehensible reference? (Something with lots of pictures mebbe - heh.) Thanks, <I'm Not Norm>...more >>

Efficient way to update unique id's
Posted by who be dat? at 6/28/2004 7:48:05 PM
Got a question. I have a situation where I have column defined as Integer. This column is being used as an ID for something and will always be unique. Let's suppose I have ten columns where the ID is numbered, starting from 1 and going from 10. The first row for will always start at 1. Suppo...more >>

Help with xp_sendmail
Posted by Dan at 6/28/2004 6:25:39 PM
I've never used this before so I'm not exactly sure if it will do what I need. Basically, I'm creating a DTS package that will run every 5-10 mins which needs to send emails to a number of people. Our table structures are like this: CREATE TABLE [dbo].[Email_List] ( [EmailListID] [int] ...more >>

SP HELP
Posted by SP Condidtions -- Help at 6/28/2004 6:03:01 PM
Sorry about that last post, I have a SP that some what works, the following is my problem. I have three conditions, I would like to have it quit if one condition is true and pull from the other two no matter what the dates are, or if the first condition is not true and the second conditio...more >>

column with MAX
Posted by shank at 6/28/2004 5:54:43 PM
How can I convert the below to add one column that reflects the highest price in the recordset? Something like MAX(Prices.Retail) AS MaxPrice SELECT Stock.*, Prices.* FROM Stock INNER JOIN Prices ON Stock.Item = Prices.Item This doesn't work... SELECT Stock.*, Prices.*, MAX(Prices.Retail...more >>



Bulk Insert and Sequence
Posted by SKG at 6/28/2004 5:02:14 PM
Does bulk insert always insert records in the same sequence. Thanks!!! ...more >>

Bitwise aggregate operator?
Posted by Ian Boyd at 6/28/2004 4:54:17 PM
i would like the engine to combine multiple int's in a bitwise fashion. Something like: SELECT SID, Type, OR(Flags) FROM ACEs WHERE SID = 34 GROUP BY SID, Type would be ideal. Any other decent way? ...more >>

User-defined data types
Posted by Praveena at 6/28/2004 4:38:01 PM
Hi all, There are appx. 40 user-defined data types whose definition has to be modified from varchar to nvarchar in a database in which there are a few hundred tables dependent on each of the user-defined data types. It therefore looks like I'd have to first get a list of the tables that are de...more >>

user defined aggregate function
Posted by kumar at 6/28/2004 4:35:01 PM
hi Can we write our own user defined Aggregate function in sql server 2000 eg median thanks ...more >>

Error in Dividing numbers
Posted by arman at 6/28/2004 4:33:05 PM
Greetings, I am converting Ms-Access to SQL server but i have problems with the formula, in Access 1/1000000 = .000001 but in SQL server the result = 0, what was the problem? Regards, Arman ...more >>

Tracking Data Changes
Posted by a at 6/28/2004 4:08:30 PM
I need to log all changes in all tables and in all fields. This includes inserts, deletes, and updates. Using SQL Profiler doesn't really do what I need because each time the server is rebooted somebody needs to get Profiler running again. Also, Profiler seems to stomp on previous log files or...more >>

How to return the key to the added record using store procedure.
Posted by Helene Day at 6/28/2004 3:55:52 PM
Sorry, I have very little experience with SQL and store procedure. My store procedure is adding a new record, and I want the generated key to be returned. How do I do this? CREATE PROCEDURE [SP_ADD_CALL] @CallDate VARCHAR(10), @CallDay VARCHAR(15), @CallTime VARCHAR(8), @CallingN...more >>

SQL Syntax Checking
Posted by Nitin M at 6/28/2004 3:51:18 PM
Hi, I did get my answers but I guess I should rephrase my question. I have to check for a query without actually running it. The mechanism should check for valid syntax as well as database objects (field names, table name etc). The query could have lots of join conditions in it, so I dont want...more >>

DATEFORMAT in a function
Posted by Andrew at 6/28/2004 3:46:18 PM
Hello Why I can use DATEFORMAT in a function but I can use it on a Procedure? How can I use DATEFORMAT in a function? Andrew ...more >>

No clue on my requirement where to start
Posted by gazawaymy at 6/28/2004 3:11:01 PM
Hi, I have a requirement that I need to come up with a SQL code but I have no clue where to start. the requirement is "If the system crashes before all the information during a transaction fails, none of those changes will be saved to the database." Please help? ...more >>

From Developers edition to Enterprise?
Posted by Chris Botha at 6/28/2004 3:00:22 PM
Hi, I have SQL Server 2000 Developers Edition installed and have to change it to Enterprise edition. Can I install the Enterprise edition just over the Developers, or does this need an un-install first? Thanks. ...more >>

SQL Syntax Checking
Posted by Nitin M at 6/28/2004 2:51:55 PM
Hi, Given some T-SQL query, can we check whether it is syntactically correct at runtime? Is there some inbuilt mechanism that SQL server provides? TIA, Nitin ...more >>

Can a trigger do this?
Posted by Ralph Krausse at 6/28/2004 2:41:30 PM
When a Update occurs, I wish to compare the current date to the date field (in that update) and if that saved date exceeds 24 hours, update a flag.... Can a trigger do this? thanks Ralph Krausse ...more >>

Inserting image files in SQL server 2000
Posted by jane201315 NO[at]SPAM yahoo.com at 6/28/2004 2:16:19 PM
Hi, I found some VB code to insert and update images in SQL Server. If say, I have some images in a folder, is there a way to actually insert either the image or a pointer to the image in a table through Enterprise Manager or SQL Query Analyzer? Any help is greatly appreciated! Thanks, Jane...more >>

[T-SQL, ADO] PRINT staement
Posted by Marek Powichrowski at 6/28/2004 1:30:18 PM
Hi all, how to catch messages printed by PRINT statement from T-SQL command executed by Ado Command in Windows envronment. TIA, Marek Powichrowski ...more >>

Job Batching to delete many records
Posted by Ralph Krausse at 6/28/2004 1:06:49 PM
I have a SP that create a temp table (Table A), of indexs to another table (Table B) of records that I need to delete in (Table B). The temp table ends of having 250,000 records. I tried to create a cursor, enum the table and the delete the records but I believe it is timing out. I was told to lo...more >>

Inserting String with '
Posted by - Steve - at 6/28/2004 12:36:39 PM
I have a program that enters a string into a SQL database. The problem I have is if a user enters a " ' " I get a syntax error. How do I get around this? Do I just have to search for the parentheses and remove it before I do my insert? -- Steve Evans Email Services SDSU Foundation ...more >>

GETDATE() in a function ???
Posted by Andrew at 6/28/2004 12:10:52 PM
Hi, Is any way to use GETDATE() in a function? I can use it in store procedures, but I get the error 443: Invalid use of 'getdate' within a function. Andrew. ...more >>

Timing out????
Posted by Ralph Krausse at 6/28/2004 11:18:23 AM
I am getting this error message with my SP ___________________________________________________________________________ [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (WrapperRead()). Server: Msg 11, Level 16, State 1, Line 0 General network error. Check your network documentatio...more >>

Any way to get at ANY data from a table that is "hanging" when you access it?
Posted by Larry Woods at 6/28/2004 11:10:46 AM
Hi, I am assuming that I have a "crashed" table on my database. I can get into other tables on the database but when I try to query a particular table I hang until timed out. ANY way to attempt any sort of analysis of "why" this is happening? And, any recovery besides complete DB recovery...more >>

DISASTER!!!
Posted by Ruslan at 6/28/2004 10:53:05 AM
Hi guy! As we know there is no ID field in sysfiles table. So when you run following statement you'll get the error message: select [id] from [sysfiles] Server: Msg 207, Level 16, State 3, Line 1 Invalid column name 'id'. But when you use the same query in where clause on a table whe...more >>

SQL Server bug
Posted by Dave at 6/28/2004 10:43:02 AM
Run this query on the pubs database: select au_fname from employee It will fail quite correctly. Now run this: select * from authors where au_fname in (select au_fname from employee) It retreives ALL the data from the database, despite the 'in' query being invalid. Anyone else fo...more >>

returning nulls when shouldn't be...
Posted by Brian Henry at 6/28/2004 10:34:30 AM
Hello, please use the database at http://www.bhplace.com/database.zip for this question... it contains the data and stored procedures for this test... In query analyzer when I run this stored procedure like this on the database: exec BENESP_AddContractCountNewMonth '1 jan 2004',574 I e...more >>

Variable Column Name in SELECT
Posted by Eric at 6/28/2004 10:32:29 AM
Hi Everyone, I am writing a procedure that needs to query a single column from a table and store the column's value in a variable. The only catch is, the name of the column I'm querying is variable. Is this possible to do? A theoretical concept would be: -------------------------------- ...more >>

Help needed with subqueries.
Posted by Strange Cat at 6/28/2004 10:30:04 AM
Hi everyone! I'm porting an old Access app to SQL Server and I have come across an awful problem... In access this app creates a query at runtime wrapping an already complicated query with a "SELECT * FROM (query here....) WHERE ...", so that to be able to build a custom where string at run...more >>

SQL triggers - and locking... causing SELECT to fail :(
Posted by JL at 6/28/2004 10:21:02 AM
Hello, I'd like to repost this on the front page since my question from last week is now many pages back... (I hope this does not break etiquette too seriously) Here is the issue: A select inside a trigger will not work on the table because of a lock condition. The trigger and select are using ...more >>

OUTER JOIN Problem
Posted by Jeff Shantz at 6/28/2004 10:19:27 AM
Hello all, I'm having a problem with a query I'm working on. I have two tables as shown below (only the relevant fields are displayed): ---------------------------------------------------------- tbl_Stats_Calls ------------------------- callDate - smalldatetime userID - bigint in_...more >>

Updating a table by inserting only data not already existent in table.
Posted by Ty at 6/28/2004 10:06:20 AM
Hi. I have a table on my SQL Server Database that I want to be able to update daily, considering a new account can be added any day. We have a dbf file on the network drive, which is where i want the data to come from. How can i go about creating an import wizard that only inserts those re...more >>

Enterprise Manager for shared server
Posted by rc at 6/28/2004 9:55:04 AM
Hello, We currently have our web site hosted and are also using a shared SQL Server for the site. When programming the site, I routinely use Enterprise Manager to design tables, look at raw data, write or diagnose Stored Procedures, etc..etc...All of this works fine. However, becaus...more >>

General performance question
Posted by Kikoz at 6/28/2004 9:33:34 AM
Hi all. Sorry for cross-posting but I'd really like to get an answer on my question. I was reading Sql Server help and found this: SQL Server 2000 has an efficient algorithm to find any existing execution plans for any given SQL statement. In most systems, the minimal resources used by th...more >>

Execute sql script through ADO.NET
Posted by PCH at 6/28/2004 8:57:27 AM
I'm trying to update several views and stored procs using a .NET app. The script it generates is valid and runs correctly through Query Analyzer, but when its executed through ADO.net, which implies a being/end transaction, it gets an error. 'ALTER VIEW' must be the first statement in a quer...more >>

number of characters limit for a view
Posted by Derek Ruesch at 6/28/2004 8:45:07 AM
Is there a limit to the number of characters that can be included in a query statement for a view? If so, is there a way to increase the number of characters? I am working on view and all of the sudden it wouldn't let me type in any more characters. Thanks for the help. Derek Ruesch...more >>

Finding elapsed time of a sql file in a .bat file
Posted by Sheetal at 6/28/2004 8:18:01 AM
Hello, Is there a way to display the execution time taken of a sql file through a batch file? Thanks in advance. Sheetal. ...more >>

Q: Using sp_executesql to return a value
Posted by Larry Woods at 6/28/2004 8:09:53 AM
I want to execute a dynamically built SQL statement of this form, using sp_executesql : .. .. ( @cnt int OUTPUT ) SET NOCOUNT ON DECLARE @SQL nvarchar(100) SELECT @cnt=COUNT(*) FROM tblX ....... 1. Can I do this? If I can't do (1) then what if I did this: SELECT COUNT(*) AS xxx FROM...more >>

Update problem
Posted by acko bogicevic at 6/28/2004 5:41:58 AM
Hi evryone I have the folowing problem I have two columns id (varchar 20) and parent(varchar 20) in table adreses Table has 20000 rows and some values in parent column are * I want those rows to change to x So this query works fine: select parent from adreses where parent='*' but the...more >>

Insert Multiple records
Posted by Dazza at 6/28/2004 3:28:01 AM
I have some contact id's in one table, but only one row per Custid. However I need to insert this data 4 times into another table. i.e CustId Desc 1 31 1 32 1 33 1 34 5 31 5 32 5 ...more >>

Isql utility
Posted by Sheetal at 6/28/2004 3:03:01 AM
Hello All, When I execute a sql file from the command line using the isql utility, it gives me an error( expected one ) in a log file stating the name of the stored procedure but its truncated ( not expected!). However, when I execute the same file in Query Analyzer, it displays the full name of ...more >>

Batch files
Posted by Sheetal at 6/28/2004 2:44:01 AM
Hello All, When I try to execute a sql file on command line using isql utility, it gives me an error (an expected one) giving the name of the stored procedure, but it's truncated(not expected!) in the log file. However, when i execute the same file in Query analyzer, the whole name is displayed. ...more >>

Getting Data from Dynamic SQL
Posted by davidku NO[at]SPAM rocketmail.com at 6/28/2004 1:58:05 AM
Hi Gurus ! Hope you can help me out ... Just a simple illustration using the examples below. I need the variable @CountRec to be returned when I execute it. When I run it, it says @CountRec not declared. It seems like dynamic SQL cannot get the data returned in this manner. --- Code -- ...more >>

How to: Export the MS Access Data to Oracle 9i
Posted by ElanKathir .S.N at 6/28/2004 1:42:04 AM
I got one mdb file with some data. I want to export these data into Oracle 9i database. So I tried to export the data to oracle through the System DSN from that MS Access mdb file, but I don’t know where it exported in the Oracle database. Means the mdb file have one table called History, But...more >>

What Is :Equal to Date_Diff and TOP
Posted by ElanKathir .S.N at 6/28/2004 1:42:00 AM
1. I have two Date in my oracle table; I want to take different between the both in years… Now I am using (Months_Between(Date1, Date2) /12) . If there any alter native, Plz let me know. 2. I want the equitant keyword of Sql server “TOP”? Ex. Select TOP 1 Id, Name from tablename M...more >>

Use float constants for speed, eg 1E0 instead of 1.0
Posted by Aaron W. West at 6/28/2004 1:11:51 AM
It seems decimals are about twice as slow to compute with as floats. So use 1E0, 2E0, etc, where it makes sense to rather than 1.0, 2.0, etc. I found that this: SELECT AVG(c1.d * 1e * c2.d) FROM calendar c1, calendar c2 Took less than half the time that this took: SELECT AVG(c1.d * 1....more >>


DevelopmentNow Blog