Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2004, 08:03 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Update question

Using Access 2003 as an interface to large SQL 2000 table containing million+ records.

I've added a new column that is a bit with a default value of 1. Unfortunately, SQL Server initializes the value of my new field to an unknown state for the records that already exist in the table. For new records, the field is initialized as 1 (true).

What I require is to set all values for the field to 1. I tried executing the following SQL statement in a stored procedure:

"UPDATE tblTable1 SET myVar = DEFAULT"

Unfortunately, when I run the update query, Access immediately reports that the procedure executed successfully without returning any records.

I then tried to executing the statement using VBA code:

Currentproject.Connection.Execute "UPDATE tblTable1 SET myVar = DEFAULT"

But Access keeps reporting a connection timeout. Wondering if anyone can explain if the UPDATE statement is acted upon immediately by SQL server. And/or another way to set all the values of my new field...

Thanks.

 
Old December 9th, 2004, 08:47 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Code:
update tbltable1
set yourcolumn=1
Jaime E. Maccou

To create a default use
Code:
CREATE DEFAULT yourcolumn AS '1'





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update inner join question Graham SQL Language 6 January 22nd, 2011 11:55 AM
Update Query Question arholly Access 2 January 19th, 2007 01:28 PM
Recordset Update question smarks Classic ASP Databases 2 March 14th, 2005 03:57 AM
DataGrid Update Question shahchi1 ASP.NET 1.0 and 1.1 Basics 2 June 11th, 2004 10:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.