Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert query

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2008-09-09 : 11:09:51
Sorry, but I am being a bit twitchy over this and I need to update a live database. Will the following insert a record for every room on tblRB_Rooms for the 12th January 2009 ? It will be run in asp.net.


Dim Newdate as date
Newdate = "12/01/2009"

'this updates Booking dates
Dim strSQL As String = "Insert tblRB_BookingDates(BD_BookingDateRef, BD_DateRequired, BD_RoomRef) " _
& " select '" & Newdate & "' + '*' + RM_RoomRef , '" & Newdate & "', RM_RoomRef from tblRB_Rooms where RM_NewRoomInd = 0"

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-09-10 : 01:53:38
It looks like you have not enough columns in the INSERT part .So this will throw an error
Also , test your code first on a test db

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-10 : 03:04:37
<<
Will the following insert a record for every room on tblRB_Rooms for the 12th January 2009 ?
>>

Test it yourself and post

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-10 : 03:49:40
You have single quote around the asterisk, which makes rest of line as a comment...



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -