Hi!
I'm accessing an MS Access database from an ASP server.
I just added a new text column (field) to one of my tables. I have not added
any data to this new field in any of the rows.
I read the field in and compare it to "" and it's coming up as false.
How do identify the empty fields?
'ASP code - Never produces "Blank"
if rsSet("region") = "" then response.write "Blank" else response.write
rsSet("region")
Try
If IsNull (rsSet("region")) Then Response.Write "Null" Else Response.Write
rsSet("region")
Alan
"Noozer" <dont.spam@.me.here> wrote in message
news:IVmAc.755870$Pk3.730376@.pd7tw1no...
> Hi!
> I'm accessing an MS Access database from an ASP server.
> I just added a new text column (field) to one of my tables. I have not
added
> any data to this new field in any of the rows.
> I read the field in and compare it to "" and it's coming up as false.
> How do identify the empty fields?
> 'ASP code - Never produces "Blank"
> if rsSet("region") = "" then response.write "Blank" else response.write
> rsSet("region")
>
|||Thanks!
"Alan Howard" <Xalan.howardX@.Xparadise.net.nzX> wrote in message
news:ONCUTnKVEHA.2928@.tk2msftngp13.phx.gbl...
> Try
> If IsNull (rsSet("region")) Then Response.Write "Null" Else Response.Write
> rsSet("region")
> Alan
> "Noozer" <dont.spam@.me.here> wrote in message
> news:IVmAc.755870$Pk3.730376@.pd7tw1no...
> added
>
|||And there are sometimes occasions when it could be a Null, or it could be a
blank. If you want to check for both at once, use:
If Len(rsSet("region") & "") = 0 Then Response.Write "Nothing" Else
Response.Write rsSet("region")
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Noozer" <dont.spam@.me.here> wrote in message
news:4MnAc.791748$oR5.380643@.pd7tw3no...[vbcol=seagreen]
> Thanks!
> "Alan Howard" <Xalan.howardX@.Xparadise.net.nzX> wrote in message
> news:ONCUTnKVEHA.2928@.tk2msftngp13.phx.gbl...
Response.Write[vbcol=seagreen]
response.write
>
Showing posts with label hiim. Show all posts
Showing posts with label hiim. Show all posts
Tuesday, March 20, 2012
Friday, February 24, 2012
Add column with variable name
HI!
Im trying to use an stored procedure to add a new column.
The problem is that the column name is stored in a variable, and I get syntax error.
Here is my code:
CREATE PROCEDURE test AS
declare @.colname as varchar(10)
set @.colname = 'new_col'
alter table prueba add @.colname int
And here is the error I get:
Error 170: Line 6 Incorrect syntax near '@.colname'
Any idea?Originally posted by soy_lore_lore
HI!
Im trying to use an stored procedure to add a new column.
The problem is that the column name is stored in a variable, and I get syntax error.
Here is my code:
CREATE PROCEDURE test AS
declare @.colname as varchar(10)
set @.colname = 'new_col'
alter table prueba add @.colname int
And here is the error I get:
Error 170: Line 6 Incorrect syntax near '@.colname'
Any idea?
Try this:
exec('alter table prueba add '+@.colname+' int')|||Originally posted by snail
Try this:
exec('alter table prueba add '+@.colname+' int')
THANKS!
Im trying to use an stored procedure to add a new column.
The problem is that the column name is stored in a variable, and I get syntax error.
Here is my code:
CREATE PROCEDURE test AS
declare @.colname as varchar(10)
set @.colname = 'new_col'
alter table prueba add @.colname int
And here is the error I get:
Error 170: Line 6 Incorrect syntax near '@.colname'
Any idea?Originally posted by soy_lore_lore
HI!
Im trying to use an stored procedure to add a new column.
The problem is that the column name is stored in a variable, and I get syntax error.
Here is my code:
CREATE PROCEDURE test AS
declare @.colname as varchar(10)
set @.colname = 'new_col'
alter table prueba add @.colname int
And here is the error I get:
Error 170: Line 6 Incorrect syntax near '@.colname'
Any idea?
Try this:
exec('alter table prueba add '+@.colname+' int')|||Originally posted by snail
Try this:
exec('alter table prueba add '+@.colname+' int')
THANKS!
Subscribe to:
Posts (Atom)