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 > december 2003 > threads for wednesday december 17

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

newbie connection error: login failed for user... Reason: not associated with a trusted sql server connection
Posted by tmaster at 12/17/2003 11:57:25 PM
I am getting the following error: "login failed for user ... Reason: not associated with a trusted sql server connection" using this connection string: wcnn.Open "Provider=SQLOLEDB.1;" & _ "Initial Catalog=LeesTest;" & _ "Data Source=LEE_LAPTOP\VSDOTNET;" ...more >>

sp_makewebtask with triggers in several tables
Posted by Stanley at 12/17/2003 11:26:08 PM
I want to make a web task that run when data in several tables change. This is my query : EXECUTE sp_makewebtask @outputfile='D:\test1.htm', @query='select * from Orders', @templatefile='D:\test1.tpl', @dbname='Northwind', @whentype=10, @datachg='TABLE=Orders COLUMN=CustomerID','TABLE=...more >>

MSDE 2000 Versions
Posted by izzy NO[at]SPAM eudoramail.com at 12/17/2003 10:45:09 PM
I was wondering if any of you guys can kindly help me in finding all the different versions of MSDE 2000 that came out since it's first release. I expected to find something similar like Sun's archive (http://java.sun.com/products/archive/index.html) for MSDE 2000 too but failed to find after a ...more >>

Bulk Insert: Unexpected end-of-file (EOF) encountered in data file
Posted by TJS at 12/17/2003 10:36:25 PM
how can a data file be fixed for this error, from the script ? ...more >>

Newbie stored proc syntax question
Posted by tmaster at 12/17/2003 9:09:29 PM
I get "Error 170: Line 6: Incorrect syntax near '@CNT' " When I try: CREATE PROCEDURE spTestProc AS DECLARE @CNT INT SELECT COUNT(*) AS @CNT FROM tblBids WHERE BidMax > 500; RETURN @CNT; Can someone help with the syntax? ...more >>

extended stored procedures
Posted by someone NO[at]SPAM somedomain.com.invalid at 12/17/2003 9:03:57 PM
Has anyone got examples (in MSVC++ 7.0) of extended stored procedures returning/populating a cursor passed in by name ? ...more >>

sproc reading tables from another sproc
Posted by Mike -- Mike at 12/17/2003 8:07:51 PM
How do I get my sproc to read data from exec sp_spaceused, which returns TWO tables? I'd like to get the 7 values into variables I declare, then my sproc will decide on maintenance to run. (Please reply to the newsgroup) TIA --Mike...more >>

Linked servers, ip and alias...
Posted by Gawelek at 12/17/2003 7:52:49 PM
I have one linked server : 192.168.153.137\SQELEK2 This name is not convenient in queries. Therefore I decided to create an alias. But can not get it working :(. In client network utility I set : Server alias : SqlXP Server name : 192.168.153.137\SQELEK2 and in query analizer I wrote : ...more >>



Is This OK?
Posted by Wayne Wengert at 12/17/2003 7:35:12 PM
I am helping a school with some minor changes to existing ASP pages (they use SQL Server 2000 back-end and ASP 3.0). I noticed that the pages all follow the sequence... Open connection Open Recordset Step through the recordset and do whatever.... Close the connection Set connection to nothi...more >>

ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint
Posted by Marcus Vinícius at 12/17/2003 7:03:06 PM
Hi, I have 2 tables... Pedidos and ConstasReceber... When I create any relationship in my child Table ContasReceber the conflict occurred.... THE ERROR: 'Pedidos' table saved successfully 'ContasReceber' table - Unable to create relationship 'FK_ContasReceber_Pedidos'. ODBC error: [M...more >>

awfully long query
Posted by Michael L. at 12/17/2003 6:41:25 PM
I have a pretty big table with an image column. How can I retrieve the total count of rows that are not empty? I tried this: SELECT count(*) from imagetable where content is not null and this: SELECT count(*) from imagetable where len(cast(content as varbinary(1)))>0 But both takes too...more >>

Row level locks - READPAST does not work
Posted by Ivan D at 12/17/2003 5:49:17 PM
Hi all, I have a problem with row-level locks. I have to create app for message processing, and get record-by-record data. Each record can be locked for some time (while processing), and other app (one more instance of the app) must get another records to process. I tried to use statement as ...more >>

SQL
Posted by Guru at 12/17/2003 5:38:08 PM
Hi all I need a SQL which converts a comma separated value as Column. Eg: The value is : '23,45,67,78,90,789,89' I need the result set as 23 45 67 78 90 789 89 Thanks in advance. Anand....more >>

Script to update Function used in calculated column
Posted by Rick Martin at 12/17/2003 5:21:11 PM
Hi, Is there anyway to alter a function used in as a table's calculated column without changing the column to a non-calculated column first? Then changing the function and then changing the column back to a calculated column. It seems like a lot of busy work. Any better way? TIA, -- Ri...more >>

Current Database
Posted by Rogério at 12/17/2003 4:42:59 PM
Hi all The statement "use database_name" cannot be used in a stored procedure. I need to know how to change the current database in a stored procedure to use a statement like this transact sql command... use db_name EXEC sp_grantdbaccess 'Corporate\GeorgeW', 'Georgie' TIA ...more >>

insert multiple records
Posted by culam at 12/17/2003 4:35:37 PM
Is there a way to insert multiple records without using insert statement on each records. Thanks In Advance, culam...more >>

Shrinking Transaction Log
Posted by LIN at 12/17/2003 4:33:44 PM
Hi, We have created a System which does over 1000 transaction every fives minutes with the database. Mostly they are insert and udpdate commands. We have noticed that the transaction log keeps increasing in size (in GBs). We have used the Shrink command at various stages but at some point of t...more >>

Update trigger advice
Posted by Tom at 12/17/2003 4:32:33 PM
Ok all bare with me I'm new to this. I have been building an update trigger to prevent administrators from disabling a userID in my userprofile table when the userID is the only user performing a role in my role table. the update to disable the userprofile is a simple for example: update us...more >>

Find SQL SERVER servers
Posted by Josep Solà at 12/17/2003 4:28:06 PM
Hi, I'm an application which configure parametres to connect a one SQL SERVER. I would want to put a combobox which list SQL SERVER server avaibles on the LAN. What can I find SQL SERVER server on LAN ? Many thanks Josep Solà ...more >>

DTS
Posted by MANDLA MKHWANAZI at 12/17/2003 4:24:37 PM
Is there a way to backup DTS jobs which is similar to backuping the database or tables and also to restored the DTS jobs? ...more >>

Personalized error message
Posted by Hechmi at 12/17/2003 4:24:31 PM
Hello, I call a stored procedure that inserts a new record to a table. In the case of error i want to display a personalized message. For instance: instead of the message 'Violation of PRIMARY_KEY' constraints,....' I want to display 'This username exists in the database' Can anyb...more >>

Dynamic WHERE Clause
Posted by Khurram Chaudhary at 12/17/2003 4:17:55 PM
Hi, I'm trying to build a dynamic WHERE clause in my stored proc. We have an ASP form that ask for two parameters however, both are not required. If a user only specifies one, i want to return the results based on one column, not on both. How can I do that? Khurram Chaudhary ...more >>

Help!! xp_sqlagent_proxy_account doesn't work.
Posted by J at 12/17/2003 4:08:22 PM
Hi All Please see code below stars ... I get the following message when executing: Msg 50001, Level 1, State 50001 xpsql.cpp: Error 87 from GetProxyAccount on line 604 The domain, account and password I'm using is a local admin account and sets the proxy account correctly, I can retrieve ...more >>

Image insert from ASP
Posted by Michael Murschell at 12/17/2003 4:07:37 PM
How do I upload a gif file into an Image field from an ASP webpage, and how do I displace a gif image that is stored in an image field on an ASP page? ...more >>

SQL SELECT statement
Posted by Tim Robertson at 12/17/2003 4:07:23 PM
Hi, I had a question last week about putting together a SELECT statement and I was helped to creat the following: SELECT * FROM dbo.CR_UTILISATEUR U1 WHERE SOCITE LIKE 'A%' OR EXISTS ( SELECT * FROM dbo.CR_UTILISATEUR U2 WHERE U2.SOCITE LIKE 'A%' AND U2.ID = U1.SOCIETE2 ) ORDER BY SO...more >>

Stored Procedures Owner Only dbo
Posted by Tim at 12/17/2003 3:31:43 PM
I would like to create a SQL statement to get a list of all user stored procedures that the owner is DBO. Please help me with this SQL statement. User Stored Procedures: select name from sysobjects where type = 'P' Thank You, Tim...more >>

updating tables in a join
Posted by Keith G Hicks at 12/17/2003 3:14:11 PM
In MS Access you can do an update on one of the tables in an inner join: UPDATE Table2 INNER JOIN Table1 ON Table2.CustID = Table1.CustID SET Table2.CustTotal = Table2.CustFees + Table1.CustTaxes It seems that this is not possible in MS SQL 2k. Is there a simple way to handle this? Tha...more >>

"Nearest Neighbors" Query?
Posted by Amy Snyder at 12/17/2003 2:40:44 PM
I have a stored proc that is returning a list of companies and their revenue in descending order: CompId Company Revenue On my front end I have checkboxes next to each record. The idea being, if you select one company and click the submit button, a graph will be created based on the clos...more >>

newbee
Posted by mahak at 12/17/2003 2:01:55 PM
I want to find the name of all the table on which triggers are disabled. I mean how can I make a query on system tables to get this. any idea? TIA...more >>

A question about efficiency
Posted by lee_j at 12/17/2003 2:00:48 PM
Hi, I ask a question that Primary Key and Index,which of them will be more efficient when you query records in a same table. Thanks for your answer! Jacks ...more >>

Apostrophe in strings?
Posted by Henrik Dahl at 12/17/2003 1:33:57 PM
Hello! Let's assume I need to put an apostrophe in a string litteral, i.e. like: select * from ... where column = 'peter's bike' How may I escape the apostrophe between r and s so that I'm able to have the apostrophe in a string literal? Best regards, Henrik Dahl ...more >>

Transaction Log fills up too fast on ALTER COLUMN script
Posted by Larry Maudell at 12/17/2003 12:41:15 PM
MS SQL SERVER 2000 I have quite an enormous table TBALE_A with a field CALCULATED_NUM -- numeric (2,2). I need to make it a numeric (6,2) When the customer runs the script below, they say trans log fills up too fast. Getting more hard-drive space is not an option. Can anyone suggest an alte...more >>

Backup database
Posted by DJ at 12/17/2003 12:10:37 PM
Is there a way to set up a job to backup a db every evening...more >>

Close database
Posted by Atash at 12/17/2003 11:34:32 AM
Hello, I want to drop my database in a sql script and re create it again. but I get "database is in use". Drop database MyTestDB Create database MyTestDB... How can I close my database before drop command? -- Atash ...more >>

Accessing SQL Server from code written in C
Posted by Mark Itzcovitz at 12/17/2003 11:25:40 AM
Hi, Does anyone have any suggestions regarding how to use SQL Server from an application written in C? DB-Library would seem to be the obvious answer, except that it is being dropped. Performance is important and volumes will be quite high at times. Currently we connect to Oracle using OCI ...more >>

Stored Procedure, Email and a log file (or an output file)
Posted by mamun_ah NO[at]SPAM hotmail.com at 12/17/2003 11:18:28 AM
Hi All, I have the following situation. 1. I am inserting data in a table (table Name is PartReturn) from a web interface. The ddls are: CREATE TABLE [dbo].[PartReturn] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Supplier_Id] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT ...more >>

How to avoid subbquery
Posted by Bob at 12/17/2003 11:13:18 AM
For the below sample, how can I return the same result without using subquery? Thanks. Select A.*, (select B.fld1 from tableB as B where A.key1 = B.key1) from tableA as A ...more >>

New transaction cannot enlist in the specified transaction coordinator.
Posted by Stretch at 12/17/2003 11:03:40 AM
I get the following error when trying to run a stored procedure: Server: Msg 7391, Level 16, State 1, Line 32 The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction. [OLE/DB provider returned message: New transaction cannot enl...more >>

Distinct Select
Posted by Neocode at 12/17/2003 10:41:25 AM
I have a SQL query, that is returning an "Incorrect Syntax" error message. I have done other very similar queries that have worked, but cannot figure out why this one won't. Here is the code. INSERT INTO PO_Branch_Percent (Branch_Name, Branch_Number, Nov) SELECT PO_Branch_Total.Branch_Name, ...more >>

DATE HELP!!!!
Posted by LARRY E T at 12/17/2003 10:17:20 AM
Can anyone out there tell me how to mask the mmddyy integer portion of GETDATE so that I can ignore the timestamp. When I Cast(getdate() as int) it rounds the date due to the time. I want to ignore the timestamp... Thanks...more >>

output file?
Posted by ll at 12/17/2003 10:14:07 AM
Hi, I want to write a SP to output the selected records to a delimiter text file, also need to include the field name as the header. How to begin? Thanks... ...more >>

Collation name
Posted by Vad at 12/17/2003 10:05:11 AM
Hi, What collation name you have to select for mixed data with Japanese and English characters? Thanks a lot, Vad ...more >>

Connection Breaks on StProc text UPDATE
Posted by danjam at 12/17/2003 10:00:32 AM
Hi, We have a simple stored procedure that has a text parameter, among others. Inside the procedure the text parameter is assigned to a text column in a simple SET clause of a simple UPDATE statement. We pass a 15 character string as an argument for the parameter, and even though the string i...more >>

Hop their is a way
Posted by ASHIKA at 12/17/2003 9:45:48 AM
Hi! I have a same set of data which I want to Update it into different table of the same database depending on the actionType All the tables has following column Firstname, Middlename, Lastname case actionType = "Abc" Update Abc set Firstname,Middlename,lastname.... ca...more >>

Dynamic Query
Posted by kgs at 12/17/2003 8:52:47 AM
Is there a way to validate the syntax of a dynamic query before executing it. thanks...more >>

Select Max
Posted by aaronss NO[at]SPAM the-mdu.com at 12/17/2003 8:40:10 AM
Afternoon All Forgive me for this one - perhaps I'm being thick, but here goes! Table 1 has membership number and member information. This has distinct member numbers within it. Table 2 has period information as to the the length of each policy and has many member numbers. Each line has a...more >>

bulk insert into views
Posted by Iraj Heravi at 12/17/2003 8:26:23 AM
Can bulk insert or bcp utility be used to insert records in views with instead of triggers? I have a view which has a union statement. I have defined an instead of insert trigger on it which allows me to insert single records into the underlying tables. However when I try to insert records ...more >>

How to convert year and weekNo to datetime?
Posted by Lasse at 12/17/2003 8:25:33 AM
Hi , I have a integer variable that represent year and week no, for example year 2003 and week no 50 shows as "350". How can I convert that to a datetime (any date that weekno) in sql? Lasse ...more >>

Datatype Conversions and Optimization
Posted by capecoder NO[at]SPAM capecoder.com at 12/17/2003 8:24:54 AM
I'm told that by using datatype conversion or casting or "WHERE field like %" in a query, the database engine bypasses any optimization gained through proper data typing and indexing and does a table scan. Is this true? Thanks in advance for your reply....more >>

Is it possible to check processes running in SQL Server through C#?
Posted by (appletonrd NO[at]SPAM hotmail.com) at 12/17/2003 7:50:38 AM
Hi all, Is it possible to check which processes are running in a SQL Server via C# code? If so, how can I do it? Which dlls must I make reference to, and if it's not asking too much, a sample code would be very appreciated :D Thanks *******************************************************...more >>

Help with query
Posted by Steve at 12/17/2003 7:45:15 AM
Simplified DDL: CREATE TABLE InspectorNormalSchedule (InspectorID int NOT NULL, BeginDay datetime NOT NULL, EndDate datetime NOT NULL) INSERT InspectorNormalSchedule VALUES (1, '1900-01-01 09:00:00.000', '1900-01-01 17:00:00.000') CREATE TABLE Inspections (InspectorID int not null, ...more >>

How to find skipped number in identity column ?
Posted by xtanto NO[at]SPAM hotmail.com at 12/17/2003 7:34:05 AM
Hi SQL Gurus, I have a table having identity as primary key : create table mytable(col1 int identity primary key, col2 char(2)) As the table grows many rows are deleted, creating 'holes' skipped number. Is there any script to quickly list all these 'holes'/ skipp...more >>

unique identifier
Posted by Daniel Rakojevic at 12/17/2003 7:31:01 AM
Hi ! I want to use a unique identifier in a table ! How can i get the next value of a unique identifier without a select on the table? Greetings, Daniel ...more >>

SQL Server 2K - Force Write To HD
Posted by amit NO[at]SPAM desiboy.com at 12/17/2003 7:25:49 AM
Today, we lost a few days worth of data (hard disk failure). Although we backup an image of the hard disk twice a day, I noticed that SQL did not have the opportunity to physically write the cached data (3 days worth of transactions in memory) to the hard disk. I understand that you can force...more >>

SQL Server Agent
Posted by kgs at 12/17/2003 7:25:02 AM
Is it possible to find if sqlagent is running or not and start it, using TSQL Thanks...more >>

Cast numeric value to datetime value
Posted by John Lewis at 12/17/2003 7:22:51 AM
I'm trying to cast date value from a numeric value in an sql server 2000. The data type is stored in the table as such: 'numeric 9(15,1)'. The query that I pass to the database is: SELECT CAST(MY_TABLE.START_NOM_DATE AS DATETIME) AS BEGIN_DATE CAST(MY_TABLE.STOP_NOM_DATE AS D...more >>

issues with changing datatype from float to decimal(18,2) on existing data in sql server 2000
Posted by srin9 NO[at]SPAM yahoo.com at 12/17/2003 6:47:29 AM
Hi, I have problem with column that save amounts in float datatype, so would like to change that to decimal(18,2).How can i do it? and what it is going effect the existing system like rounding and things like that.my database is on sql server 2000.any help Thanks in advance nivas....more >>

Data vanishing from SQL Server
Posted by dipankarganguly NO[at]SPAM hotmail.com at 12/17/2003 6:47:27 AM
Hi, Please help me to solve the following scenario. We are working on SQL Server 7.0 on Windows NT Server with Raid 5 . We are using a front end application through which all the things are done. For the last few days we are finding that certain sets of transactions are disappearing from ...more >>

Asynchronous running of BULK INSERT
Posted by Ron L. at 12/17/2003 6:41:27 AM
I have a large text file that takes the BULK INSERT command several minutes to load records into my SQL Server 2000 database. My two questions are: 1) Is it possible to run the BULK INSERT command in the background using some kind of asynchronous property so that other operations can be p...more >>

stop wrong characters in key
Posted by blarfoc NO[at]SPAM yahoo.com at 12/17/2003 6:21:10 AM
hello, i have a inventory parts table with a varchar(20) primary key. i do not want the people to make part names with any characters but 0-9, A-Z, or one and only "." but there can be zero "." characters. i was to do a trigger but must i use a cursor to move through all rows from INSERTED tab...more >>

SQL/Access 2000
Posted by JeffQ at 12/17/2003 5:42:51 AM
I am using DTS to import data from an Access 2000 DB into SQL 2000 however when it gets to tables that have a timestamp an error occurs and it doesn't copy the data in that table. Does anyone have a clue?...more >>

SELECT STATEMENT
Posted by hngo01 at 12/17/2003 5:39:29 AM
Hi all, I have two tables with: table1 PKID, LASTNAME, FIRSTNAME, THIRDPARTYCODE 1 LN1 FN1 HF5 2 LN2 FN2 091/823 table2 THIRDPARTYCODE, CODE_DESC 091 SOMETHING1 823 SOMETHING2 HF5 SOMETHING3 I want to select to recordset and return to my application: PKID, LASTNAM...more >>

exec stored proc
Posted by vinski NO[at]SPAM hot.ee at 12/17/2003 3:48:04 AM
how can I execute stored procedure when I don't want to wait when it is finished? select * ... exec proc1 select * ... <- this select have to be run immediately after proc1, without waiting while it's funished vinski...more >>

SQL Parameters
Posted by Jim Heavey at 12/17/2003 3:35:31 AM
Hello - I have a couple of question about building SQL Parameters for a C# application. I am using the sp_sproc_columns as a basis for mechanically building the parms necessary for my application. That Stored procedure returns a column called "column Type" which identifes the "direction"...more >>

What's happen with Stored Procedures
Posted by Duong Van Tuan at 12/17/2003 2:32:04 AM
Pls help me to solve a problem (Thanks in advance)! I make a stored procedure and input 2 parametors for it: CREATE PROC sp_ProvinceDetails;1 @Date_EOS varchar(40), @Item_Province1 varchar(40) AS SELECT EOSNumber.EOSCode as [EOS Code],EOSNumber.ITUCause as...more >>

illegal sql statement
Posted by TJS at 12/17/2003 2:13:48 AM
what is wrong with this statement ? keeps returning "illegal SQL statement" CREATE PROCEDURE [dbo].[xxxxx] @vTable varchar(50) AS .... -- compiles if next 3 lines are commented out DECLARE @SQL1 varchar(100) SET @SQL1 = 'TRUNCATE TABLE ' + @vTable EX...more >>

Data vanishing
Posted by Dipankar Ganguly at 12/17/2003 1:52:01 AM
Hi, Please help me to solve the following scenario. We are working on SQL Server 7.0 on Windows NT Server with Raid 5 . We are using a front end application through which all the things are done. For the last few days we are finding that certain sets of transactions are disappearing from ...more >>

Per Seat Licences
Posted by Iain at 12/17/2003 1:30:26 AM
Hi, I've got a web application that runs on an intranet, ASP pages as the user interface, VB6 business layer and an SQL Server database. Is there anyway that I can restrict the number users who can use the site at any one time? Users are not connecting anonymously, if that helps. Th...more >>

Changing the account used by SQL Server
Posted by Andy at 12/17/2003 1:21:07 AM
We wish to change the account used to run SQL Server ( i.e. the service) Is this as simple as stopping the service and changing the account, or are there other issues I should be aware of Luckily its a development, not a live server that has been setup incorrectly, so server downtime isn't an is...more >>


DevelopmentNow Blog