Ask a Question related to ASP Database, Design and Development.
-
Insert Bln into new column?
How does one execute a one time INSERT query inside the data window of a
particular table for all records >1...
The table has referential integrity on StateID...here is my stab but I am
picking up a SYNTAX ERROR near 'Begin':
IF (SELECT StateID
FROM State
WHERE StateID > 0) BEGIN
(INSERT
INTO State(StateBln)
VALUES (1)
WHERE StateID > 0) END
The query needs to deposit the Int value (1) into newly created column
StateBln...
Thanks
Jason
Guest
-
INSERT file to column
I have done some due diligence looking for an answer, but I have not found it so here is my post: I have a table t_CustomerFiles, with two... -
Return value of 'serial' column on insert
Hi all, I have several tables with an 'id' column which is a simple 'serial unique' type. Often when I insert a record the next thing I need is... -
Index on Computed Column and ADO Insert
Thanks nntp! <nntp> wrote in message news:#x9nW5OQDHA.1560@TK2MSFTNGP12.phx.gbl... was INSERT ON ARITHABORT with -
Have server get value for column on Insert?
Consider: CREATE TABLE Transactions ( TransactionGUID uniqueidentifier, TransactionNumber int, TransactionDate, SessionGUID, ...) CREATE... -
Which is the best column to insert index...
...in a "linking" table? T1 ---------- Id--Name 1 -- xav 2 -- fab T2 ---------- -
Bob #2
Re: Insert Bln into new column?
com wrote:
You can't use WHERE with VALUES. What are you trying to do? Insert a new
record? If so, you don't need a WHERE clause do you? Or are you trying to
update an existing record? If so, you need to use an UPDATE statement, not
an INSERT.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Guest
-
Re: Insert Bln into new column?
Damn, I'm stupid....too little sleep is my excuse! This works:
UPDATE State
SET StateBln = '1'
WHERE (StateID > 0)
Many thanks Bob
Jason
"Bob Barrows [MVP]" <SPAMcom> wrote in message
news:phx.gbl...
> You can't use WHERE with VALUES. What are you trying to do? Insert a new
> record? If so, you don't need a WHERE clause do you? Or are you trying to
> update an existing record? If so, you need to use an UPDATE statement, not
> an INSERT.
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>[/ref]
Guest
-
Harag #4
Re: Insert Bln into new column?
On Fri, 13 Aug 2004 12:11:02 -0400, <com> wrote:
You could do the following as well if a row doesn't exist in a table
then add a new row or update an existing one.
IF EXISTS(SELECT StateID FROM State WHERE StateID > 0)
BEGIN
UPDATE State SET StateBln='1' WHERE StateID>0
-- Some Error checking code here
END
ELSE
BEGIN
INSERT INTO State(StateBln) VALUES('1')
-- Some Error checking code here
END
Also please don't top post on usenet.
HTH
Al
>> You can't use WHERE with VALUES. What are you trying to do? Insert a new
>> record? If so, you don't need a WHERE clause do you? Or are you trying to
>> update an existing record? If so, you need to use an UPDATE statement, not
>> an INSERT.
>>
>> Bob Barrows
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so I
>> don't check it very often. If you must reply off-line, then remove the
>> "NO SPAM"
>>
>>[/ref]
>[/ref]
Harag Guest
-
Re: Insert Bln into new column?
Awesome!!! many thanks.
ps: 'Top post' ? Not sure what this means....?
-Jason
"Harag" <net> wrote in message
news:com...
>
>
> You could do the following as well if a row doesn't exist in a table
> then add a new row or update an existing one.
>
>
> IF EXISTS(SELECT StateID FROM State WHERE StateID > 0)
> BEGIN
> UPDATE State SET StateBln='1' WHERE StateID>0
> -- Some Error checking code here
> END
> ELSE
> BEGIN
> INSERT INTO State(StateBln) VALUES('1')
> -- Some Error checking code here
> END
>
>
> Also please don't top post on usenet.
>
>
> HTH
>
> Al
>
> [/ref][/ref]
column [/ref][/ref]
new [/ref][/ref]
to [/ref][/ref]
not
> >[/ref]
>[/ref]
Guest
-
Harag #6
Re: Insert Bln into new column?
On Fri, 13 Aug 2004 14:08:54 -0400, <com> wrote:
No probs. :)
Top Post is exactly this posting at the very top of all the replies
rather than posting below what your actually replying to.
Personally I don't mind it (saves me scrolling down) as I read this
using a offline browser and but a lot of people mind. so I've now
started not to top post as well.
HTH
Al.
>>
>>
>> You could do the following as well if a row doesn't exist in a table
>> then add a new row or update an existing one.
>>
>>
>> IF EXISTS(SELECT StateID FROM State WHERE StateID > 0)
>> BEGIN
>> UPDATE State SET StateBln='1' WHERE StateID>0
>> -- Some Error checking code here
>> END
>> ELSE
>> BEGIN
>> INSERT INTO State(StateBln) VALUES('1')
>> -- Some Error checking code here
>> END
>>
>>
>> Also please don't top post on usenet.
>>
>>
>> HTH
>>
>> Al
>>
>> [/ref]
>column [/ref]
>new [/ref]
>to [/ref]
>not
>>[/ref]
>[/ref]
Harag Guest
-
Harag #7
Re: Insert Bln into new column?
On Fri, 13 Aug 2004 14:08:54 -0400, <com> wrote:
just found this url that might exaplain it better than I did:
http://www.caliburn.nl/topposting.html
HTH
Al
>>
>>
>> You could do the following as well if a row doesn't exist in a table
>> then add a new row or update an existing one.
>>
>>
>> IF EXISTS(SELECT StateID FROM State WHERE StateID > 0)
>> BEGIN
>> UPDATE State SET StateBln='1' WHERE StateID>0
>> -- Some Error checking code here
>> END
>> ELSE
>> BEGIN
>> INSERT INTO State(StateBln) VALUES('1')
>> -- Some Error checking code here
>> END
>>
>>
>> Also please don't top post on usenet.
>>
>>
>> HTH
>>
>> Al
>>
>> [/ref]
>column [/ref]
>new [/ref]
>to [/ref]
>not
>>[/ref]
>[/ref]
Harag Guest
-



Reply With Quote

