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 > september 2003 > threads for tuesday september 2

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

xp_sendmail
Posted by JJ Wang at 9/2/2003 11:07:53 PM
Hi, I am trying to set up a job to check on certain updates done on my database, if no updates done, then it will send out email to me use master..xp_sendmail. when I try to assing @message, I want to assign a string to it and a varchar variable after the string, which contains yesterd...more >>


delete self referencing foreign key
Posted by Pravin at 9/2/2003 10:55:39 PM
I have a table named Emp as follows: empid int empname varchar(35) mgrid int empid empname mgrid 1 abc null 2 pqr 1 3 lmn 2 4 xyz null empid is primary key. mgrid is self referencing foreign key field towards emp...more >>

lots of inserts
Posted by MJ at 9/2/2003 10:29:58 PM
What will be the best way to combine several inserts on different tables? I have a table A, when there's an insert into A, I'll need to insert the data also into tables B, C,D,E,F,G & H. Then based on the previpous insert, table I & K have to be populated as well. If there's an error on th...more >>

Unexpected query behavior
Posted by Vern Rabe at 9/2/2003 10:21:04 PM
Why doesn't the query return two rows? create table A (col1 char(1)) create table B (col1 char(2)) insert into A values ('x') insert into B values ('x') insert into A values (NULL) insert into B values (NULL) select * from A join B on (A.col1 = B.col1 or (A.col1 is ...more >>

problem with has_dbaccess?
Posted by alucarrd NO[at]SPAM yahoo.com at 9/2/2003 10:06:07 PM
I have a very strange problem with my application. I am using sql-dmo to build an online enterprise manager. We are currently doing a stress test on it (We created about 250 databases and have some users login using IP). However, we are getting a problem intermittently. What happened is that...more >>

Best practices in updating application database schema
Posted by Vadim at 9/2/2003 9:29:04 PM
Hi, 1.My application uses sql server 7/2000, I release new versions of the app quite often and they are accompanied with db changes (usually adding new fields and sometimes adding triggers and SPs). What is the best way to send db updates to customers? 2. How to get description of tabl...more >>

bcp question.
Posted by Jacobus at 9/2/2003 9:16:34 PM
bcp "select top 1 [data] from data_table" queryout c:\temp\x1.zip -n -T The above is creates a zip file from data_table.[data]. However the zip file appears to be corrupted (and was valid when I stored it). What is going on and are there better ways to extract data from a text field and ...more >>

Another Newbie
Posted by Austin Henderson at 9/2/2003 8:24:52 PM
Trying to insert into a field that is varchar(20) but I want to pad the entry with "0" on the beginning of it... so if the item to be written is 10 chars long I want to write 10 "0" on the front of the item.. how to accomplish? Thanks -- Austin Henderson <>< Network Administrator ...more >>



Newbie Help
Posted by Austin Henderson at 9/2/2003 8:17:40 PM
Looking to create a flat file from a stored proc that is comma delim.. can this be done? I know I can use DTS but the table is a temp table and that wont work. Thanks for your help in advance. -- Austin Henderson <>< Network Administrator ...more >>

SQL2000 and SOAP
Posted by Paal Jeppedal at 9/2/2003 7:42:45 PM
Hi, I'm about to write some IVR scripts where I need to validate some data against a database located on a Tandem machine. My IVR only supports ODBC data access, and the data I need to validate against is only accessible through a SOAP interface ... I do not know anything about SOAP, but I...more >>

USE statement
Posted by Paul K at 9/2/2003 5:49:23 PM
I'm having a problem using the USE statement in a script. Here's the code: --Create the database. CREATE DATABASE DIOMS ON PRIMARY (name=DIOMS, filename='C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL$NEWSQL\DATA\DIOMS.MDF', size=10MB, filegrowth=10%) LOG ON (name='DIOMSLog', file...more >>

Generates SP.
Posted by Zoury at 9/2/2003 5:42:36 PM
Hi there! :O) I'm wondering if there is a way to insert a stored procedure into a database using code? We've made a script that generates all our "select" stored procedure since that had a little something special that the wizard couldn't do. Is there a way to insert each stored procedure into...more >>

How can I get an UPDATE violation to still change the non-violating records?
Posted by Bodi Klamph at 9/2/2003 5:03:45 PM
Hi If I'm using an UPDATE statement to change some records, but the changes will cause key violations, the entire update will fail. I want it to change the ones that can be changed anyway, and just skip over the violating ones. example id1 and id2 together create the primary key Id1...more >>

Output a table as a string
Posted by at 9/2/2003 4:39:59 PM
how to select one column, two rows as a string, without using a temp table or cursor desired output is 1,2 create table #test (f1 char(1)) insert into #test values ('1') insert into #test values ('2') select * from #test ...more >>

Distributed transaction woes
Posted by TJoker .NET at 9/2/2003 3:38:58 PM
Hi folks. I'm having a data visibility issue when using distributed transactions but I'm not sure if this is normal or I'm doing something wrong. I have this object hierachy that is going to be saved as one transaction. Each object has a Save() method that creates a SQLConnection and executes a ...more >>

Collation error, single DB
Posted by Jonas Bush at 9/2/2003 3:16:25 PM
I've taken over ownership of a database that used to reside on an Australian server, but has since been copied over to one in the US. I added a new table and am trying to run a query that joins an existing one to the new one, and I'm getting this error: Cannot resolve collation conflict for e...more >>

Converting varchar to varbinary
Posted by Darran at 9/2/2003 3:02:16 PM
Hi, I'm trying to convert a varchar value to a varbinary and I'm getting some strange results: This works as expected: print cast(255 as binary) returns: 0x0000000000000000000000000000000000000000000000000000000000FF but this statement: declare @test varchar(3) select @test = ...more >>

Using xp_cmdshell..
Posted by Yaheya QUazi at 9/2/2003 2:54:13 PM
Hi I have the following query... Declare @sql varchar(1000) Set @sql = 'SELECT a long query... ' Set @sql = @sql + ' more long query... ' EXEC master..xp_cmdshell 'bcp @sql queryout c:\temp\Authors.txt -c -Sxfiles -Usa -Psarules' obviously it is not working...what am I doing wron...more >>

MSSQL VIEW problem, Update not working (adCriteriaKey)
Posted by Arthur Hoornweg at 9/2/2003 2:52:18 PM
Hello all, I'm having a hard time implementing row-level security in a MS SQL Server 2000 database. I have now implemented a view (with the help of some readers in this forum, thanks!). This view grants the user access to a limited subset of the records in my table, it looks a bit like thi...more >>

Understanding XML
Posted by JemPower at 9/2/2003 1:57:22 PM
I don't know if this is the right newsgroup, apologies if not, but can someone explain to me the following... If I type in... SELECT dbo.umc_Messages.mSender, dbo.umc_Messages.mDateSent, dbo.umc_Messages.mRelation FROM dbo.umc_MessageTransactions INNER JOIN ...more >>

Updating Tables
Posted by mimi at 9/2/2003 1:36:37 PM
Hi all, I am trying to insert some records into one table from six. How do I update my fact table with the data from the six other fact tables distinctly? The tables will have duplicate data so I'm only trying to get the missing records....more >>

logic
Posted by Rick at 9/2/2003 1:21:13 PM
How could you implement the XOR operator in SQL SErver 2000? Rick....more >>

Standard Parent Child queries needed
Posted by Ajit Singh at 9/2/2003 1:19:19 PM
It would be helpful if anybody can provide me a set of standard queries/stored procedures/UDF's to do all standard operations on a table with parent-child format i.e. a single table containing a key_id and a parent_key_id. Some of the operations are: 1. provide all the childs of a selected ...more >>

Index on a temp. table
Posted by Jane at 9/2/2003 1:11:57 PM
I create an index on a temp. (#aaa) table but when I tried to look it up in sysindex, it said it did not exist but when I re-run the create index statement, it said, it is already created. Which system table can I use to look up more information about this index? Thanks in advance for you...more >>

SPACEUSED
Posted by Roberto Carrasco at 9/2/2003 1:10:53 PM
Hi, Please Help me ! Very strange situation I'm using the system stored procedure sp_spaceused <<TABLE NAME>> and the procedure is returning me a number of rows wrong ! ! ! for example TABLE - A - select count(*) from a - 3495 - SP_SPACEUSED A 3493 he is calculating a wrong number of rows,...more >>

Creating a BCP-style Format file with DMO's BulkCopy
Posted by Rob Jones at 9/2/2003 1:07:59 PM
I'm trying to use DMO's BulkCopy to create a format file so that I may export table data from one instance of SQL 2000 and import the data into another instance of SQL 2000. Everything I've tried will not create a format file; I get SQL-DMO unspecified errors when I spec a format file. I've ...more >>

fields in rows to fields in columns?
Posted by Mia Johnson at 9/2/2003 1:04:26 PM
Hello, I have an association table between my buildings and my occupancy classes because multiple classes can be defined for one building. My table is like this: BldgSec_ID Occup_Class 1 A1 1 B1 2 C3 2 F4 For a report, I am...more >>

how to retrieve up to 255 chars from nText field?
Posted by Rich Protzel at 9/2/2003 1:04:25 PM
Hello, I need to retrieve data from an nText field. There may be no data in the field for one row or there may be several k of data. I was trying to use the Len and Left functions but got an error message that you can't use nText with these functions. Is there a way to retrieve only 255 ch...more >>

Update triggers: old and new values
Posted by Lars B. Dybdahl at 9/2/2003 12:44:09 PM
I want to write a trigger that modifies the new values (after the updated) based on what the fields contained before and after the update. I know how to select from "inserted" and "deleted", but how do I modify the new values? The "inserted" dataset isn't updatable. Lars Dybdahl. ...more >>

compare binary with string..
Posted by Sender at 9/2/2003 12:40:53 PM
I have a software developed by someone else in VB. It stores the data in SQL Server. On a screen on one field it shows the data in string form. But when I go in the back end (SQL Server) and read that data it shows "binary". It's datatype is binary. In SQL Query Analyzer I want to compare whet...more >>

Help with SQL : SQL Server 2000
Posted by Venugopal Vemuri at 9/2/2003 12:33:25 PM
Hi, I have a table with two columns which is as underL Table Name : test Plant Qty 20 10 30 40 40 50 50 60 ... .. I want an sql that would give an output: Plant Qty Plant Qty Plant Q...more >>

Simple Query
Posted by Rick at 9/2/2003 12:29:31 PM
Hi: What is the structure of a SELECT clause where the table is located on an external server? Suppose: Server Name = SomeServ Database = SomeDB Table = SomeTable Thank you. Rick....more >>

Multiple files in BULK INSERT?
Posted by Rog Fe de Leon at 9/2/2003 12:04:04 PM
I have the following that reads a csv file into a table. How can I add multiple csv files into this one statement. Like for test1.csv, test2.csv, test3.csv...etc. BULK INSERT Northwind.dbo. [acstest] FROM 'c:\test.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', FIRSTROW = 2 ...more >>

Unable to UPDATE w/Access
Posted by Bea at 9/2/2003 11:52:16 AM
Hello, I use Access forms to update already saved data on SQL2k. At 'SAVE', a window pops up stating that an other user has changed the data and suggests to save the changes in the Notepad. But, it doesn't save it to the server. Saving new data into a new row, works fine; it only happens when I'...more >>

Building a stored procedure
Posted by Loukas Marinis at 9/2/2003 11:42:15 AM
I was wondering if there is a way to build a procedure passing as arguments the name of the table and the record Id. Since record id is always in first column can i make someting like the following? ( @tbl nvarchar(20), @rcd int ) As set nocount on select * from table = @tabl...more >>

Truncate Log File
Posted by KT at 9/2/2003 11:24:28 AM
My database .MDF files is about 38 MB, however my .LDF file is 2.2 GB. How can I 'truncate' the transaction log down from 2 gigabytes. I have tried SHRINK with and without move pages / remove free space. I have done a complete DB BACKUP, no luck... any ideas.. Thanks K ...more >>

Inserting multiple rows into multiple tables
Posted by Scott Good at 9/2/2003 11:22:57 AM
Hi, I currently have two tables Table1 and Table2, and two databases Current and Backup. Table2 has a foreign key relationship with Table1. I want to insert some rows from Table1 and Table2 from Backup into Current. I know I can insert multiple rows from Backup's Table1 to Current's ...more >>

SQL Code Beautifier
Posted by Allan Wang at 9/2/2003 10:50:29 AM
Hi all, Does anyone know if there is a program to reformat SQL statements for SQL Server? Thanks Allan ...more >>

Looping and results set
Posted by fabriZio at 9/2/2003 10:40:40 AM
I have an sp that returns me a table with 1 column and one or more rows. I pass to my sp a scalar HEX value EXEC ExtractOnBits 0xC00000000000000000000000000000 (very thanks to Dan Guzman to build this sp) returns me: Result ------ 1 2 Now I have a table of HEX values (or better...more >>

Howto: Aggregate counts?
Posted by Martin R-L at 9/2/2003 10:27:30 AM
Is it possible to get a result set like with SQL: ID Pos Number =20 ------------------------ 344 1 1 456 2 654 3 835 2 1 978 2 from the table ID Pos ? =20 Thanx! // Martin R-L...more >>

udpate query using joins
Posted by Sandra at 9/2/2003 10:25:43 AM
Does anyone know what I need to do to make this query return only one value. Thanks in advance for any help. Sandra UPDATE BTR_RENTAL_UNIT SET RU_USAGE_TYPE_ID= (SELECT RU.RU_USAGE_TYPE_ID FROM COM_RU_USAGE_TYPE_LK RU RIGHT JOIN BTR_SAP_TENANCY S ON (RU.RU_USAGE_TYPE_NBR = S.RU_USAGE_TYPE...more >>

SP with cursor (cross-tab kind of thing)
Posted by Bent Lund at 9/2/2003 10:16:19 AM
Hello, i'm struggling with a stored procedure that will make sort of crosstab from one table an insert into an other. The source table: PK FK VALUE 1 1 aaaa 2 1 aaaa 3 1 aaaa 4 1 bbbb 5 1 cccc Destination table has the folloving columns One row in...more >>

for Session_ID
Posted by Johnny at 9/2/2003 9:48:51 AM
Hi,all Oracle can produce a unique session ID for every connection to database and it can also tell users whether a connection is active by providing a function using session ID as a parameter. So can SQLServer provide such the same function? If can, please tell more detail. Thanks begin...more >>

Duplication Rule
Posted by Eric at 9/2/2003 9:42:59 AM
Hi, I don't want duplicate information in a field of my table. I don't want to make it a primary key. How would I go about denying duplication in that field. Would I create a Rule? If so, what is the syntax to check for duplication? TIA, Eric...more >>

T-SQL statement help
Posted by Ed at 9/2/2003 9:23:19 AM
I need some help with a T-SQL statement. Any help would be greatly appreciated. Database has one table with two fields: FileName & FilePath. FileName and FilePath individually are not unique, but together they must be unique: FileName FilePath 1 "DailyReport" C:\......more >>

THE answer to SQLMAIL
Posted by user extraordinaire at 9/2/2003 8:38:11 AM
How can i put this: SQL MAIL Sucks. I never got it to work after many Win2K Svr, SQL2k Svr reload, Office 2000, Outlook 2000, Office XP reloads.....Forget it. Put IIS/SMTP Service secured as a relay from 127.0.0.1 ONLY. IN SQL use: sp_OACreate to create a CDONTS mail object and send away...more >>

Identity
Posted by sardinka at 9/2/2003 8:34:17 AM
I have a table where I have a column type_id with identity set=1. For each s_id,a_id I need to identity should increase by 1 when I run the insert query. For some reason the query take the max(type_id_ regardless of s_id,a_id. Please help me modify query. INSERT r_type(r_type,s_id,a_id) ...more >>

Cannot resolve collation conflict for column 1 in SELECT statement.
Posted by Inzy 2000 at 9/2/2003 8:15:08 AM
serverA : sql 7.0 serverB : sql 2000 I upgraded dbs from 7.0 to 2000 on serverB. now, trying to run the query (please see below) on serverB is giving me the error message: select a.* from openrowset('SQLOLEDB', 'serverA';'sa';'pwd',' select DISTINCT BUSINESS as [Business Unit],count...more >>

Using VB for an extended stored proc.
Posted by Ron Lounsbury at 9/2/2003 7:58:40 AM
Can anyone point me to information on how to write an extended stored proc using Visual Basic? We have a project which will need to build an interface between an IBM MQSeries queuing server and MS SQL 2k. TIA Ron Lounsbury ...more >>

Parms to UDF
Posted by Dave at 9/2/2003 7:01:14 AM
Is it possible to pass a parameter to a User Defined Function when it is included in the From clause: select cust.* from myCustomerTable cust, MyUDF(cust.customerID) ==== I know that it works in the Where clause: where CustMyDate = dbo.MyUDFDate(getdate()) ==== It also w...more >>

Is it correct that you cannot use an INSTEAD OF INSERT trigger to set a NOT NULL value
Posted by brian.pacitti NO[at]SPAM infotechnics.co.uk at 9/2/2003 6:52:38 AM
Hi there, I am converting an Oracle system to SQLServer. There are loads on instances where, on an insert, the Oracle system has triggers that set various NOT NULL values depending on certain conditions. The client side does not specify these columns during insert (since it does not know the ...more >>

relationships
Posted by Jefferson at 9/2/2003 4:01:55 AM
hello Anybody knows if is it possible to create a relationship=20 between 2 tables on different databases? If it=B4s possible, how can I do that? thanks...more >>

Arrays to procedure
Posted by girishpal NO[at]SPAM hotmail.com at 9/2/2003 2:57:42 AM
Can arrays be passed to the stored procedures?...more >>

2 parameters problem
Posted by shau at 9/2/2003 2:27:28 AM
Hi i have created a stored proc but have never created one where two values are available to search by but only one will be used to search the database can anyone see why my code doesnt work please..thanks in advance for any help create proc spsearchsicodearea @siccode varchar @area nvar...more >>

Job calling Store Proc containing restore Loop exits after first iteration
Posted by Jensen at 9/2/2003 2:06:36 AM
SQLSERVER 2000 Sp3, Windows 2000 AS I have written a stored procedure which uses a while loop to run though a backup file and generates the Restore commands and brings a DR database up to date. The transaction file is appended to during the day on the Production system. The TRN file is co...more >>

Batch Processing
Posted by Phil at 9/2/2003 1:59:16 AM
Anyone know of good sites for sql batch processing guidelines / batch processing patterns? ...more >>

SQL 2k udf;s and Stored Procedure
Posted by hrishikesh at 9/2/2003 12:50:02 AM
hey guys can u tell me where should i use stored procedure and where should UFD's? ...more >>

Using Compute
Posted by Roy Goldhammer at 9/2/2003 12:25:06 AM
Hello there I have table with data of date customer and money. I need to build query that summarized the total money of each client. If the number of customers is bigger then 10 i need to show 9 customers with the highest money and the rest of then as Other For example: a - 100, b-20...more >>


DevelopmentNow Blog