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 > july 2004 > threads for thursday july 8

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

Mail receive
Posted by microsoft at 7/8/2004 11:12:32 PM
Hi I have SQL2k. I have configured the mail profile and SQLMail server is running. Now, how can i can receive mails (go to POP3 server and get mail) Thanks -- ----------------------------------------------------------------- Matviyuk Maxim Director R&D Ethrix Ltd. mobile: +972-68-21...more >>


SQL Error Messages
Posted by Jay at 7/8/2004 11:00:02 PM
I have a stored procedure where I try to insert into a table. Some = times the insert will fail because of a primary key constraint. I want = to ignore that message. I want my VB.NET program to not even be aware = of the error. Even though I handle the error in the SP using @@error I = cann...more >>

Correct Syntax for Ranking Query
Posted by wiredog NO[at]SPAM comcast.net at 7/8/2004 10:52:33 PM
In SQL SERVER 2000 I have the following data. Names of 100 Radio Stations The song names played on each of the 100 Radio Stations The number each song has played at each of the 100 radio stations. From this I would like to get-- The NAMES of each of the 100 Radio Stations with The TOP 10 ...more >>

Query Help
Posted by JDP NO[at]SPAM Work at 7/8/2004 10:00:36 PM
I have c1 table Franchise records that have an associated Franchise record in the cs table. I also have primary contact records in c1 that are not a Franchise record. I want to use the zip from a primary record, query the cs table to find a matching zip in the notes field and return the Fran...more >>

How to monitor Triggers in VB6
Posted by dudebig at 7/8/2004 8:14:14 PM
I have this triggers in T-SQL to execute when a product qty is 0, it does work, but I have to be able to monitor this on a remote PC using VB6. I know how to execute storeproc with VB6, but this is something I cannot figure it out yet. I have this same problem when trying to get an Activit...more >>

A question about connect to SqlServer 2000 in ms-dos 6.22
Posted by jack.lee at 7/8/2004 7:01:56 PM
Hi, I have an old dos programe which connect to sqlserver 6.5. Now I want to upgrad the sqlserver to sqlserver 2000.But I can't connect the database -- sqlserver 2000.Then how can I connect to sqlserver 2000 in ms-dos 6.22.Any advice will be appreciated. Thanks! Jack ...more >>

How to drop a table with foreign key constraint table in a sp ?
Posted by Fico at 7/8/2004 6:43:01 PM
How to drop a table with foreignkey constraint table in sp or a VB sub procedure? Thanks. ...more >>

Data Type for durations, part 2!!!
Posted by Richard Rogers at 7/8/2004 6:33:22 PM
Hi again, I've written a pair of functions, and for the most part, they work extremely well: -- Exec sp_AddType 'T_Duration', 'Numeric(9,2)', 'Not Null' -- Exec sp_AddType 'T_DurationStr', 'Varchar(15)', 'Not Null' -- 'hhh:mm:ss.m' Create Function dbo.fnStringToDuration (@StrIn T_Dur...more >>



how to shrink tran-logs of databases
Posted by JJ Wang at 7/8/2004 6:12:15 PM
hi, work on sql server 2000. I have serveral dbs that are either 'full' or 'simple', their tran-logs have lots of empty space in it due to one- time big processes, hence, I want to shrink their physical size down. I used the below query on several dbs, some log size got shrinked, som...more >>

how to add new article to existing publication without reinitialization
Posted by JJ Wang at 7/8/2004 5:21:33 PM
hi, I am working on sql server 2000 replication. I have an existing publication from server1 to server2 which has 6 tables in the publication. Now I want to add two more tables into this publication. How can I do it without have to re-initialize it? is it always better to re-initi...more >>

Row index or something like that?
Posted by Zeljko Turbic at 7/8/2004 4:09:25 PM
Hi, I'm wondering if this is possible: I have table with only one column (name) and stored data e.g. (John, Mike, Peter ...) now I want., with sql query, to get ouput like this: 1 John 2 Mike 3 Peter ... where numbers are row index in table. Is that possible? Thanks i...more >>

CROSS-TABULATION Help needed - PLEASE!
Posted by Mike Perry at 7/8/2004 4:03:45 PM
Fairly new to T-SQL and still learning basics here, but I have an immediate need to come up with an AR Aging Report which compiles and cross-tabulates two tables. Table AROPEN includes the following fields: CUST_NBR, INVOICE NUMBER, INVOICE_DATE, and INVOCE_AMT Table UNAPPLIEDCASH includes ...more >>

Row number - simply?!
Posted by Gnum at 7/8/2004 3:48:05 PM
Hi guys, Do you know if it's possible to change following Query: SELECT ___ as Num, whatever FROM Table WHERE whatever = whatever ORDER BY whatever the way it returns: 1: 1, whatever 2: 2, whatever 3: 3, whatever .... so on where 1,2,3 is row numbers in returned recordset. Ple...more >>

Joining to a table on another Server.
Posted by John316 at 7/8/2004 3:47:35 PM
Not clear on the prerequisites to hit a table On a different Server. I'm fine when joining tables from different DBs on the same server but when I need something in a table on a different server, I'm missing something. I Know it should be ServerName.dbName.owner.tblName but..... select top...more >>

Stored Procedure Problem
Posted by George at 7/8/2004 3:42:00 PM
I create a stored procedure that returns top 5 records based on username that is passed in. It works great when the name has no spaces however if it does have spaces it does not return anything. Why is that? Thanks ...more >>

String matching best ways
Posted by Anup at 7/8/2004 3:39:59 PM
Hi All I have a tablw which has names of districts and also contain id in that table but when we get data to be processed we get only the names so what is the best way to match these as it may also have spelling mistakes I do something like this JOIN on Substring(fieldname,1,5)=substring(fiel...more >>

Counting values in a column - small error
Posted by bear at 7/8/2004 3:27:18 PM
There's a small error in the script I just posted - corrected below - where I was trying to make a primary key from a null default column. Sorry! And thanks for any help. The results of a survey of consumer preference is stored in a table, below. Persons can indicate for each of three produc...more >>

Linked server to Oracle
Posted by Yaheya Quazi at 7/8/2004 3:10:12 PM
I have setup a linked server to an oracle server. Everything works fine but when I try to run queries as below select * from banner.UCM_DEV.BANINST1.TZVIDEN I get the following error... Server: Msg 7312, Level 16, State 1, Line 1 Invalid use of schema and/or catalog for OLE DB provid...more >>

HELP please! Counting different values in a column
Posted by bear at 7/8/2004 2:52:40 PM
The results of a survey of consumer preference is stored in a table, below. Persons can indicate for each of three products (one per column) whether they 1 strongly like - Hard - or 2 moderately like - Soft - that product. Zero or null values in product columns are not counted. Persons can also ...more >>

Why does SQL Server round numbers of double type?
Posted by buran at 7/8/2004 2:37:38 PM
Dear Programmers, I want to store a number of .NET type double (16,95) into the database column of type numeric, but it is stored as integer (17) and when I call the value in my application, it is displayed as 17. How can I solve this problem? Thanks in advance, Burak ...more >>

Attendance
Posted by Jeffrey Shantz at 7/8/2004 1:41:39 PM
Hello all, I'm creating a balanced scorecard web application for my company (a call center). One of the performance indicators is attendance. Calculating an attendance percentage at the agent-level is easy: [sum of all absent days] / [sum of total days in reporting period]. However, I n...more >>

Select * from Table XXX Name
Posted by PK at 7/8/2004 1:31:26 PM
Declare a variable XXX a table name = TableXXXName ( insert variable between Table and Name) how to write a select statement where table name got insert a variable ? Select * from Table+XXX+Name .......can not Select * from Table%XXX%Name......can not Select * from Table&XXX&Name .......c...more >>

fetch absolute or relative.
Posted by Tim at 7/8/2004 1:21:58 PM
I need to code a read ahead loop in my sql. If I find a certain record I need to read ahead to find the match and determine if the two need to be exported or not. Under normal conditions the next record is the match, but there could be two or more records in between. I think I want to...more >>

Row id
Posted by kumar at 7/8/2004 1:17:34 PM
hi Is there any way to access the row id in the sql server in oracle we have ROWID but i was unable to find it in sql thanks kumar...more >>

SELECT . . . ORDER BY - SQL 2000 vs. JET 4
Posted by fnoell_cisi NO[at]SPAM hotmail.com at 7/8/2004 1:00:55 PM
I have 2 data sets, one in a SQL 2000 database, the other in a Jet 4.0 database. I am using ADO, and a select statement to extract an identically keyed subset with an ORDER BY for a field (part number). Initially, an extract is made from the SQL database to create the Jet database. The Jet da...more >>

Tracing program execution on production environment, what tools to use?
Posted by faustino Dina at 7/8/2004 12:57:45 PM
Hi, I'm debugging some weird problems on stored procedures/triggers inside transactions, on a production server. I can't use tracing. So for the moment I used sp_send_cdosysmail for tracing sp/triggers execution by sending mails to myself. I dare is a better way to do that. Is it another way t...more >>

Which is the best approach?
Posted by Jaja at 7/8/2004 12:56:25 PM
We need to create a record based on the insert/update on three tables and then moved/update to two tables residing on a different database. Table1 Table2 Table3 Client Name Lognumber lognumber Lognumber Clinical Notes Appt.date ...more >>

Stored Proc won't compile in master
Posted by stephanie.harrell NO[at]SPAM stateauto.com at 7/8/2004 12:41:25 PM
I have a strange situation. I have a stored proc I am trying to compile in the master database. I get the following error message Server: Msg 134, Level 16, State 2, Procedure sp_send_samail, Line 75 The variable name '@From' has already been declared. Variable names must be unique within a ...more >>

failure of job item
Posted by robert at 7/8/2004 12:35:10 PM
as in query analyzer, when a "divide by zero" occurs, the result be automatically set to null and the execution will resume. but when a stored procedure is executed in a job item, it fails when such an error happens. can anyone tell me if there is any option I can set to resume the execut...more >>

Application got "locked out"
Posted by Mike at 7/8/2004 11:49:21 AM
Hello. One of our developers executed an ad-hoc INSERT INTO ... WHERE ... statement that inserted about 49,000 records. While this ran, an application that utilizes the table that was being Inserted Into timed out while trying to access the table. I assume that SQL Server somehow locked thi...more >>

Transaction with linked server
Posted by Nikola Milic at 7/8/2004 11:28:58 AM
Hi, When I open transaction with insert statement from linked server and that linked server is not available, then connection is stuck and MySQLSServerTable is locked (see script below). When I kill connection it cannot finish rollback until SQL server restart. How can I cancel transaction or k...more >>

QUERY .....
Posted by PVR at 7/8/2004 11:06:35 AM
Hello Sql Gurus, Please throw some light on the following query. I had a table with 2 columns col1 days 10 10 10 1 10 30 10 50 10 60 20 30 20 40 20 60 col1 daysout daysout dayout 1 - 30 31 - 60 61-90 10 3 2 0 20 1 2 0 Thanks in Advanc...more >>

Declaring @RegionID
Posted by Ty at 7/8/2004 10:51:40 AM
If this is a snipet of my code, how can I go about supplying parameters so that @regionID equals the value from a drop down list, ddl reps. Here's the select: SELECT * FROM AccountTransfers WHERE FromRegionID = @RegionID OR ToRegionID = @RegionID heres the method: Sub BindDataToGri...more >>

Maximum Memory for standart edition / enterprise
Posted by simo sentissi at 7/8/2004 10:06:29 AM
Hello there I am runing on sql 7 environment and planing to move to 2k environment (quite late but......). for one of the databases, I have a server with 4G of ram but I have only sql server standart, I am wondering if it will still take 4 G of ram since MS claims it will take only 2 G???? f...more >>

Possible Bug in SQL Server 2000?
Posted by david_green NO[at]SPAM softhome.net at 7/8/2004 9:52:24 AM
Hi guys, I have hit this bug more than once and was wondering if anyone else has ever seen it? SELECT A.nId ,B.nId FROM Server1.myDB_1.dbo.TableA A LEFT OUTER JOIN Server2.myDB_2.dbo.TableB B ON B.nId = A.nId WHERE A.nId IN (SELECT cId FROM Server1.myDB_3.dbo.LogTable WHER...more >>

outer join question
Posted by Beema at 7/8/2004 9:45:23 AM
I am using an "left outer join", but am not getting rows back where I thought I would. Table "Item" contains one rows per item Table "Item_Cost" contains multiple rows per item, with an "ACTIVE_COST" flag indicating the current cost. select i.desciption, ic.Item_cost fr...more >>

Cursor vs. table data type
Posted by dw at 7/8/2004 8:35:18 AM
Hello, all. We need to loop through the values in one table and compare them with values in another. Which is more efficient -- a cursor or a table data type for the first table? For example, this is the sort of query we run, -- from the cursor on the 1st table, we get @strCourseSection and @s...more >>

max value query
Posted by tachyon at 7/8/2004 8:16:17 AM
Hi all, What I'm essentially trying to do is: for a table (table1) containing the columns x, y and z select * from "the row containing the max value for column y in table1" If someone could help out with how to actually write this query properly, it would be very much appreciated Cheers...more >>

Ordering by date not working
Posted by Moe Sizlak at 7/8/2004 7:32:56 AM
Hi There, My query below has an order by clause that is not working, could someone help with the syntax please? Cheers, Moe Select lbllocation, tblListings.location, tblListings.formid, tblformlbl.formid , tblListings.listeddate from tblListings,tblformlbl WHERE tblListings.formid=tb...more >>

Count problem
Posted by anonymous NO[at]SPAM discussions.microsoft.com at 7/8/2004 6:29:04 AM
I have the following tables: (simplified) Customers: Master Custid C(2) Programs: Master Progid C(4) CustPrograms: Details. Custid C(2) Progid C(4) UserPermissions C(1) ProgramsUsed: Details Custid C(2) Progid C(4) Date DateTime I'd like to calculate how many times every cus...more >>

remove identity column
Posted by kumar at 7/8/2004 6:29:01 AM
hi, 1)is there any easy way to disable identity property of a column in a stored procedure. In entraprise manager it is very easy to do . 2) I was trying to insert into a table with a identity column using a dynamic sql statement and i tryed to use identity_insert on , but it did not work. ...more >>

SET ARITHABORT ON/OFF ????
Posted by AndyBrew at 7/8/2004 4:18:02 AM
Hi I have a general question with regards to the various switches that can be set to ON or OFF. I have a client that I issue with SQL Script patches to allow them to fix problems, update their databases etc. The problem I am suddenly having is that they are getting errors when running the scripts...more >>

Inserting an empty row into various tables
Posted by angela NO[at]SPAM kaisen.co.uk at 7/8/2004 3:41:11 AM
Hi I have various table, one for each different type of exam (e.g. tblExamOne, tblExamTwo etc). tblExamOne will have a design like this userid| Answer1 | WMScore | Answer2 | etc. Each exam table contains the userID but vary with no. of other columns When a person picks the exams they...more >>

apply stored procedure to each row in a result set
Posted by roger at 7/8/2004 3:08:10 AM
This is probably a FAQ and/or something you just cant' do, but I'll ask anyway... Say you'ge got a table variable into which you've selected some rows from some table. Can you then iterate over the rows in the table variable, in an analogous sort of way to how you might use a cursor to it...more >>

problem updating value of one cell
Posted by RioDD at 7/8/2004 2:37:01 AM
I have an problem updating value of one cell. This cell is nvarchar format, and it is supposed to contain data from one column. lets say for example, all the data in the column "FirstName" with some privileges needs to be inserted in a cingle cell into another table. I've tryed with: update ta...more >>

WORDS TO NUMBERS
Posted by Phil at 7/8/2004 2:27:01 AM
Hi All, I dont suppose anyone know's of a funtion or code that can be used to change the word for a number to it's numerical value, e.g. one=1, two=2, three=3 I think I have seen it somewhere but I could just be hoping. Thanks Phil...more >>

URGENT HELP NEEDED WITH COLUMNS_UPDATED()
Posted by Jaan Klouman at 7/8/2004 2:17:06 AM
I am having great difficulty with getting COLUMNS_UPDATED() to work they way I want. The problem I am attempting to solve is as follows: I have a table with 27 columns, the last of which is a Timestamp column. This table is access from Microsoft Access 2000 with a bound form. Even though us...more >>

Need help with reordering items
Posted by News at 7/8/2004 2:08:41 AM
Hi, I need an advice how to do this better: table Cities, columns: City, Country_id, Order_id City Order_id Country_id NY 1 1 Chicago 2 1 Washington 3 1...more >>


DevelopmentNow Blog