Tuesday, March 27, 2012
Adding a new field to an existing table with image field
I have a concern about adding a new field to an existing table with image
field - which is huge.
Will there be a problem with some databases, where they have a hard time
locating data correctly after such a large field? I was advised to put all
the big fields at the end of the table.
Thanks> I was advised to put all
> the big fields at the end of the table.
I don't know why you were given this advice. The position of columns within
a row does not affect performance.
Unless you specify the 'test in row' option, a row contains only a pointer
to a separate area containing the image.
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21" <u25822@.uwe> wrote in message news:6566a618c09ff@.uwe...
> Hi,
> I have a concern about adding a new field to an existing table with image
> field - which is huge.
> Will there be a problem with some databases, where they have a hard time
> locating data correctly after such a large field? I was advised to put
> all
> the big fields at the end of the table.
> Thanks
>|||Thanks. I was given this advice as this problem seem to occur before.
Hmm.. what is this "test in row" option?
Dan Guzman wrote:[vbcol=seagreen]
>I don't know why you were given this advice. The position of columns withi
n
>a row does not affect performance.
>Unless you specify the 'test in row' option, a row contains only a pointer
>to a separate area containing the image.
>
>[quoted text clipped - 7 lines]|||> Thanks. I was given this advice as this problem seem to occur before.
I would ask the person who gave you this advise the underlying rationale.
> Hmm.. what is this "test in row" option?
That's a typo :-) I meant to say 'text in row'.
With the 'text in row' table option, values smaller than the specified size
are stored in the data row itself rather than in separate text/image pages.
This can help performance when your images are small enough to fit on the
data page and are most often selected along with the other data. I doubt
this appropriate in your case since you mentioned that the values are large.
See the Books Online for a complete description of the 'text in row' table
option.
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21" <u25822@.uwe> wrote in message news:6566ff6f0d4fc@.uwe...
> Thanks. I was given this advice as this problem seem to occur before.
> Hmm.. what is this "test in row" option?
> Dan Guzman wrote:
>|||The concern to put all big fields at the end of the table wasn't about
performance - but rather the pointers in the db getting 'lost' when they hav
e
to find a column's data that was located after a very, very big column.
Even though i not sure if this really happens
Dan Guzman wrote:[vbcol=seagreen]
>I would ask the person who gave you this advise the underlying rationale.
>
>That's a typo :-) I meant to say 'text in row'.
>With the 'text in row' table option, values smaller than the specified size
>are stored in the data row itself rather than in separate text/image pages.
>This can help performance when your images are small enough to fit on the
>data page and are most often selected along with the other data. I doubt
>this appropriate in your case since you mentioned that the values are large
.
>See the Books Online for a complete description of the 'text in row' table
>option.
>
>[quoted text clipped - 15 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200608/1|||> Even though i not sure if this really happens
Perhaps the person experienced some sort of corruption and attributed the
cause to the position of large columns. As far as I know, this concern is
not warranted. There is no reason to place large columns (text or
otherwise) at the end of the row.
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21 via droptable.com" <u25822@.uwe> wrote in message
news:6578e9948dd22@.uwe...
> The concern to put all big fields at the end of the table wasn't about
> performance - but rather the pointers in the db getting 'lost' when they
> have
> to find a column's data that was located after a very, very big column.
> Even though i not sure if this really happens
>
> Dan Guzman wrote:
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200608/1
>|||eeyore21 via droptable.com wrote:
> The concern to put all big fields at the end of the table wasn't about
> performance - but rather the pointers in the db getting 'lost' when they h
ave
> to find a column's data that was located after a very, very big column.
> Even though i not sure if this really happens
>
Sounds like old advice from a dBase or Foxpro person... Doesn't apply
to SQL Server...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Adding a new field to an existing table with image field
I have a concern about adding a new field to an existing table with image
field - which is huge.
Will there be a problem with some databases, where they have a hard time
locating data correctly after such a large field? I was advised to put all
the big fields at the end of the table.
Thanks> I was advised to put all
> the big fields at the end of the table.
I don't know why you were given this advice. The position of columns within
a row does not affect performance.
Unless you specify the 'test in row' option, a row contains only a pointer
to a separate area containing the image.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21" <u25822@.uwe> wrote in message news:6566a618c09ff@.uwe...
> Hi,
> I have a concern about adding a new field to an existing table with image
> field - which is huge.
> Will there be a problem with some databases, where they have a hard time
> locating data correctly after such a large field? I was advised to put
> all
> the big fields at the end of the table.
> Thanks
>|||Thanks. I was given this advice as this problem seem to occur before.
Hmm.. what is this "test in row" option?
Dan Guzman wrote:
>> I was advised to put all
>> the big fields at the end of the table.
>I don't know why you were given this advice. The position of columns within
>a row does not affect performance.
>Unless you specify the 'test in row' option, a row contains only a pointer
>to a separate area containing the image.
>> Hi,
>[quoted text clipped - 7 lines]
>> Thanks|||> Thanks. I was given this advice as this problem seem to occur before.
I would ask the person who gave you this advise the underlying rationale.
> Hmm.. what is this "test in row" option?
That's a typo :-) I meant to say 'text in row'.
With the 'text in row' table option, values smaller than the specified size
are stored in the data row itself rather than in separate text/image pages.
This can help performance when your images are small enough to fit on the
data page and are most often selected along with the other data. I doubt
this appropriate in your case since you mentioned that the values are large.
See the Books Online for a complete description of the 'text in row' table
option.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21" <u25822@.uwe> wrote in message news:6566ff6f0d4fc@.uwe...
> Thanks. I was given this advice as this problem seem to occur before.
> Hmm.. what is this "test in row" option?
> Dan Guzman wrote:
>> I was advised to put all
>> the big fields at the end of the table.
>>I don't know why you were given this advice. The position of columns
>>within
>>a row does not affect performance.
>>Unless you specify the 'test in row' option, a row contains only a pointer
>>to a separate area containing the image.
>> Hi,
>>[quoted text clipped - 7 lines]
>> Thanks
>|||The concern to put all big fields at the end of the table wasn't about
performance - but rather the pointers in the db getting 'lost' when they have
to find a column's data that was located after a very, very big column.
Even though i not sure if this really happens
Dan Guzman wrote:
>> Thanks. I was given this advice as this problem seem to occur before.
>I would ask the person who gave you this advise the underlying rationale.
>> Hmm.. what is this "test in row" option?
>That's a typo :-) I meant to say 'text in row'.
>With the 'text in row' table option, values smaller than the specified size
>are stored in the data row itself rather than in separate text/image pages.
>This can help performance when your images are small enough to fit on the
>data page and are most often selected along with the other data. I doubt
>this appropriate in your case since you mentioned that the values are large.
>See the Books Online for a complete description of the 'text in row' table
>option.
>> Thanks. I was given this advice as this problem seem to occur before.
>[quoted text clipped - 15 lines]
>> Thanks
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200608/1|||> Even though i not sure if this really happens
Perhaps the person experienced some sort of corruption and attributed the
cause to the position of large columns. As far as I know, this concern is
not warranted. There is no reason to place large columns (text or
otherwise) at the end of the row.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"eeyore21 via SQLMonster.com" <u25822@.uwe> wrote in message
news:6578e9948dd22@.uwe...
> The concern to put all big fields at the end of the table wasn't about
> performance - but rather the pointers in the db getting 'lost' when they
> have
> to find a column's data that was located after a very, very big column.
> Even though i not sure if this really happens
>
> Dan Guzman wrote:
>> Thanks. I was given this advice as this problem seem to occur before.
>>I would ask the person who gave you this advise the underlying rationale.
>> Hmm.. what is this "test in row" option?
>>That's a typo :-) I meant to say 'text in row'.
>>With the 'text in row' table option, values smaller than the specified
>>size
>>are stored in the data row itself rather than in separate text/image
>>pages.
>>This can help performance when your images are small enough to fit on the
>>data page and are most often selected along with the other data. I doubt
>>this appropriate in your case since you mentioned that the values are
>>large.
>>See the Books Online for a complete description of the 'text in row' table
>>option.
>> Thanks. I was given this advice as this problem seem to occur before.
>>[quoted text clipped - 15 lines]
>> Thanks
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200608/1
>|||eeyore21 via SQLMonster.com wrote:
> The concern to put all big fields at the end of the table wasn't about
> performance - but rather the pointers in the db getting 'lost' when they have
> to find a column's data that was located after a very, very big column.
> Even though i not sure if this really happens
>
Sounds like old advice from a dBase or Foxpro person... Doesn't apply
to SQL Server...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Adding a new field to a table with image field
Hi,
I have a concern about adding a new field to a table with image field - which is huge.
Will there be a problem with some databases, where they have a hard time locating data correctly after such a large field?
Previously this happened to me, and what was advised to put all the big fields at the end of the table.
Thanks.
I have not heard of such impact caused by the order of columns. When SQL search table to locate a row, it either uses table scan (when no index exists on the table) from the IAM page, or utilize indexes (clusetered/nonclustered) if there is any on the table. To learn more about table structuer, you can refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_da2_8sit.asp
I recommend you to read <Programming a Microsoft® SQL Server™ 2000 Database> if you're interesting in this, which includes a topic "How SQL Server Retrieves Stored Data".
Sunday, March 25, 2012
Adding a field whose value DEPENDS on other fields in table
Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
another field for Status (a generic field) , which has value :
1.Open if the value of the field OPEN_STATUS=T ,
2.InProcess if the value of the field INPROCESS_STATUS=T
3.Completed if COMPLETED_STATUS=T.
Is there a way to do this ?...maybe by writing these if statements? How can
this be done? I know this is not a good desgin but already many applications
are using these 3 fields which I dont want to change... So is there any way
of creating this new field in the same table based on the criteria specified
above?
Thanks for any help.
--
pmudTry creating a calculated column.
alter table t
add status as case when OPEN_STATUS='T' then 'Open' when
INPROCESS_STATUS='T' then 'InProcess' when COMPLETED_STATUS='T' then
'Completed' else 'UNKNOWN' end
go
Are those columns exclusive?, because the expressions inside CASE will be
evaluated in the same order as they appear.
AMB
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to ad
d
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How ca
n
> this be done? I know this is not a good desgin but already many applicatio
ns
> are using these 3 fields which I dont want to change... So is there any wa
y
> of creating this new field in the same table based on the criteria specifi
ed
> above?
> Thanks for any help.
> --
> pmud|||You might also consider changing the name of the table. then create a view
with the original table name and include the special column in the view...
This will insulate you and theprogrammers from future changes.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"pmud" <pmud@.discussions.microsoft.com> wrote in message
news:9176C167-F9FB-48D4-AA84-6DA690D02B76@.microsoft.com...
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to
> add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How
> can
> this be done? I know this is not a good desgin but already many
> applications
> are using these 3 fields which I dont want to change... So is there any
> way
> of creating this new field in the same table based on the criteria
> specified
> above?
> Thanks for any help.
> --
> pmud|||the solution using a caculated field is good if the field does not have to b
e
indexed or searched against (slow).
If the field has to be indexed or searched and the table has lots of rows,
consider using a trigger to calculate and store the value.
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to ad
d
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How ca
n
> this be done? I know this is not a good desgin but already many applicatio
ns
> are using these 3 fields which I dont want to change... So is there any wa
y
> of creating this new field in the same table based on the criteria specifi
ed
> above?
> Thanks for any help.
> --
> pmud
Adding a field whose value DEPENDS on other fields in table
Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
another field for Status (a generic field) , which has value :
1.Open if the value of the field OPEN_STATUS=T ,
2.InProcess if the value of the field INPROCESS_STATUS=T
3.Completed if COMPLETED_STATUS=T.
Is there a way to do this ?...maybe by writing these if statements? How can
this be done? I know this is not a good desgin but already many applications
are using these 3 fields which I dont want to change... So is there any way
of creating this new field in the same table based on the criteria specified
above?
Thanks for any help.
pmud
Try creating a calculated column.
alter table t
add status as case when OPEN_STATUS='T' then 'Open' when
INPROCESS_STATUS='T' then 'InProcess' when COMPLETED_STATUS='T' then
'Completed' else 'UNKNOWN' end
go
Are those columns exclusive?, because the expressions inside CASE will be
evaluated in the same order as they appear.
AMB
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How can
> this be done? I know this is not a good desgin but already many applications
> are using these 3 fields which I dont want to change... So is there any way
> of creating this new field in the same table based on the criteria specified
> above?
> Thanks for any help.
> --
> pmud
|||You might also consider changing the name of the table. then create a view
with the original table name and include the special column in the view...
This will insulate you and theprogrammers from future changes.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"pmud" <pmud@.discussions.microsoft.com> wrote in message
news:9176C167-F9FB-48D4-AA84-6DA690D02B76@.microsoft.com...
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to
> add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How
> can
> this be done? I know this is not a good desgin but already many
> applications
> are using these 3 fields which I dont want to change... So is there any
> way
> of creating this new field in the same table based on the criteria
> specified
> above?
> Thanks for any help.
> --
> pmud
|||the solution using a caculated field is good if the field does not have to be
indexed or searched against (slow).
If the field has to be indexed or searched and the table has lots of rows,
consider using a trigger to calculate and store the value.
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How can
> this be done? I know this is not a good desgin but already many applications
> are using these 3 fields which I dont want to change... So is there any way
> of creating this new field in the same table based on the criteria specified
> above?
> Thanks for any help.
> --
> pmud
sql
Adding a field whose value DEPENDS on other fields in table
Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
another field for Status (a generic field) , which has value :
1.Open if the value of the field OPEN_STATUS=T ,
2.InProcess if the value of the field INPROCESS_STATUS=T
3.Completed if COMPLETED_STATUS=T.
Is there a way to do this ?...maybe by writing these if statements? How can
this be done? I know this is not a good desgin but already many applications
are using these 3 fields which I dont want to change... So is there any way
of creating this new field in the same table based on the criteria specified
above?
Thanks for any help.
--
pmudTry creating a calculated column.
alter table t
add status as case when OPEN_STATUS='T' then 'Open' when
INPROCESS_STATUS='T' then 'InProcess' when COMPLETED_STATUS='T' then
'Completed' else 'UNKNOWN' end
go
Are those columns exclusive?, because the expressions inside CASE will be
evaluated in the same order as they appear.
AMB
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How can
> this be done? I know this is not a good desgin but already many applications
> are using these 3 fields which I dont want to change... So is there any way
> of creating this new field in the same table based on the criteria specified
> above?
> Thanks for any help.
> --
> pmud|||You might also consider changing the name of the table. then create a view
with the original table name and include the special column in the view...
This will insulate you and theprogrammers from future changes.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"pmud" <pmud@.discussions.microsoft.com> wrote in message
news:9176C167-F9FB-48D4-AA84-6DA690D02B76@.microsoft.com...
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to
> add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How
> can
> this be done? I know this is not a good desgin but already many
> applications
> are using these 3 fields which I dont want to change... So is there any
> way
> of creating this new field in the same table based on the criteria
> specified
> above?
> Thanks for any help.
> --
> pmud|||the solution using a caculated field is good if the field does not have to be
indexed or searched against (slow).
If the field has to be indexed or searched and the table has lots of rows,
consider using a trigger to calculate and store the value.
"pmud" wrote:
> Hi,
> Three fields in my database table are , OPEN_STATUS, INPROCESS_STATUS,
> COMPLETED_STATUS. The values of these are T (true) or F . Now I need to add
> another field for Status (a generic field) , which has value :
> 1.Open if the value of the field OPEN_STATUS=T ,
> 2.InProcess if the value of the field INPROCESS_STATUS=T
> 3.Completed if COMPLETED_STATUS=T.
> Is there a way to do this ?...maybe by writing these if statements? How can
> this be done? I know this is not a good desgin but already many applications
> are using these 3 fields which I dont want to change... So is there any way
> of creating this new field in the same table based on the criteria specified
> above?
> Thanks for any help.
> --
> pmud
adding a field
documentation. Is it an ALTER TABLE?you got it
alter table is it.
google alter table
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?|||Alter table add <columnname> <datatype>
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?|||Yes it's the ALTER TABLE statement.
If you look in BOL it's under ALTER TABLE, but the code is :
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
Adam J Warne, MCDBA
"Les Stockton" wrote:
> What's the SQL for adding a field to a table? And can you direct me to th
e
> documentation. Is it an ALTER TABLE?|||Yes, it's:
ALTER TABLE table_name ADD col_name col_type col_nullability;
For example,
ALTER TABLE T1 ADD col1 INT NOT NULL DEFAULT(0);
SQL Server's Books Online has info about this under ALTER TABLE.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?
Adding a Field
I am adding a field an SQL table. This field will not be used a PK or FK.
It is just another field to hold data.
My question is at the point of saving the field into the table I get a
screen that says "The following tables will be saved to the database...list
of a bunch of tables". What is that? I am not doing anything to the relate
d
tables at all.
RichRich wrote:
> Hello Group,
> I am adding a field an SQL table. This field will not be used a PK or FK.
> It is just another field to hold data.
> My question is at the point of saving the field into the table I get a
> screen that says "The following tables will be saved to the database...li
st
> of a bunch of tables". What is that? I am not doing anything to the rela
ted
> tables at all.
> Rich
Don't modify your tables using Enterprise Manager - script the changes
using ALTER TABLE, then you can see precisely what error you're running
in to.
All of your database objects should be created/altered using DDL
scripts, and those scripts should be stored safely away in a version
control package.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hello Tracy,
I did not think that it was an error however using a script seems to make
sense. Let me check this.
Rich
"Tracy McKibben" wrote:
> Rich wrote:
> Don't modify your tables using Enterprise Manager - script the changes
> using ALTER TABLE, then you can see precisely what error you're running
> in to.
> All of your database objects should be created/altered using DDL
> scripts, and those scripts should be stored safely away in a version
> control package.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Rich wrote:
> Hello Tracy,
> I did not think that it was an error however using a script seems to make
> sense. Let me check this.
>
Maybe not an "error", so to speak, but still likely to be something more
meaningful than what you get in Enterprise Manager.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hello Tracy,
I am looking at BOL and do not see anything on adding a field into a
table...I would hate to have to create a new table and then move the data
into the new table...can I just script a new field only?
Rich
"Tracy McKibben" wrote:
> Rich wrote:
> Don't modify your tables using Enterprise Manager - script the changes
> using ALTER TABLE, then you can see precisely what error you're running
> in to.
> All of your database objects should be created/altered using DDL
> scripts, and those scripts should be stored safely away in a version
> control package.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||Oops...
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
<<<<<<<<<<<<<<
I always get tripped up on that syntax.
[vbcol=seagreen]
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||I just made that mistake today, that's why I recognized it immediately in th
e post here.
:-)
--
HTH
Kalen Delaney, SQL Server MVP
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:Orbz5lGrGHA.3992@.TK2MSFTNGP04.phx.gbl...
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
<<<<<<<<<<<<<<
I always get tripped up on that syntax.
[vbcol=seagreen]
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>
Adding A default value in a column in a declare statment
I have this querey at the minute but when I attempt to put the default value of IND in the Sales Rep Code field I get an error Invalid column name, if I try and put 'IND' AS [Sales Rep Code] I get an incorrect syntax error.
DECLARE @.Query nVarchar(1000)
SET @.Query = N'SELECT NULL AS [GEO UNIT], NULL AS [PMC Invoice Date], IND AS [Sales Rep Code] FROM '+ 'Test' + RIGHT(DATEPART(yy, GETDATE()), 2) + '_' + CASE WHEN DATEPART(m, GETDATE()) IN ('11', '12', '1')
THEN 'Q1' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('2', '3', '4') THEN 'Q2' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('5', '6', '7')
THEN 'Q3' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('8', '9', '10') THEN 'Q4' END END END END + '.dbo.all_data' EXECUTE sp_executesql @.Query, N'@.level tinyint', @.level = 35
Can anybody please help on this.
ThanksHi Can anybody help me.
I have this querey at the minute but when I attempt to put the default value of IND in the Sales Rep Code field I get an error Invalid column name, if I try and put 'IND' AS [Sales Rep Code] I get an incorrect syntax error.
DECLARE @.Query nVarchar(1000)
SET @.Query = N'SELECT NULL AS [GEO UNIT], NULL AS [PMC Invoice Date], IND AS [Sales Rep Code] FROM '+ 'Test' + RIGHT(DATEPART(yy, GETDATE()), 2) + '_' + CASE WHEN DATEPART(m, GETDATE()) IN ('11', '12', '1')
THEN 'Q1' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('2', '3', '4') THEN 'Q2' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('5', '6', '7')
THEN 'Q3' ELSE CASE WHEN DATEPART(m, GETDATE()) IN ('8', '9', '10') THEN 'Q4' END END END END + '.dbo.all_data' EXECUTE sp_executesql @.Query, N'@.level tinyint', @.level = 35
Can anybody please help on this.
Thanks
would help us if u could post the ddl for the table|||what is the dataytpe of [Sales Rep Code]?
Off the cuff, it looks like your IND value is supposed to be a string.
Your example would be OK if you use 'IND' as [Sales Rep Code] - with the single quotes around IND.|||hi,
The datatype for SalesRep code is not defined as its in a view and I am creating the column [Sales Rep Code] with the default value of IND,
e.g
Select 'IND' AS [Sales Rep Code] from test would create a [Sales Rep Code] populated by IND for each row.
I have tried the 'IND' and it appears that it is incorrect syntax, this is beacuse it is closing the string value of the declare statment at the fist ' but I dont have a way around this.
Any Ideas|||Hi thanks for everyones help finally got it working but I still have one problem in that it is over 4000 carachters long and the @.test has a maximum of 4000 carachters is there any way around this.
Thanks
Thursday, March 22, 2012
Adding 2 text fields together
record text?
Thanks In Advance,
MPMYou'll need to create a trigger. An example might be:
CREATE TRIGGER SetFullName ON Customers
FOR INSERT, UPDATE
Not for replication
AS
/* set fullname for Customers */
update Customers
set Customers.FullName = inserted.[FirstName] + ' ' +
inserted.[Surname]
from inserted
where Customers.CustomerID = inserted.CustomerID
"MANCPOLYMAN" wrote:
> is it possible to concatenate two fields of record text into one field of
> record text?
> Thanks In Advance,
> MPM
Adding 2 text fields together
record text?
Thanks In Advance,
MPM
You'll need to create a trigger. An example might be:
CREATE TRIGGER SetFullName ON Customers
FOR INSERT, UPDATE
Not for replication
AS
/* set fullname for Customers */
update Customers
set Customers.FullName = inserted.[FirstName] + ' ' +
inserted.[Surname]
from inserted
where Customers.CustomerID = inserted.CustomerID
"MANCPOLYMAN" wrote:
> is it possible to concatenate two fields of record text into one field of
> record text?
> Thanks In Advance,
> MPM
Adding 2 text fields together
record text?
Thanks In Advance,
MPMYou'll need to create a trigger. An example might be:
CREATE TRIGGER SetFullName ON Customers
FOR INSERT, UPDATE
Not for replication
AS
/* set fullname for Customers */
update Customers
set Customers.FullName = inserted.[FirstName] + ' ' +
inserted.[Surname]
from inserted
where Customers.CustomerID = inserted.CustomerID
"MANCPOLYMAN" wrote:
> is it possible to concatenate two fields of record text into one field of
> record text?
> Thanks In Advance,
> MPM
Tuesday, March 20, 2012
Adding "All" value to parameter field
I just want to know if is it possible to add a "ALL" value to the drop down
list of a parameter field?
I can't seem to manually add the "ALL" value after I specify that the
parameter's values are taken from a query.
For example, I have a parameter, "Country" and its values are taken from a
query. Now I have the country values populated. How do I add the ALL value
from here?
Thanks,Use a union in the original query to add a dummy 'All' record to your
primary result set. I've used that on many similar occasions.
Julian Bowker
Marble Steps Systems
"et_ck" <etck@.discussions.microsoft.com> wrote in message
news:0971547C-4373-4AB3-9F57-F4BCFAE44756@.microsoft.com...
> Hi,
> I just want to know if is it possible to add a "ALL" value to the drop
> down
> list of a parameter field?
> I can't seem to manually add the "ALL" value after I specify that the
> parameter's values are taken from a query.
> For example, I have a parameter, "Country" and its values are taken from a
> query. Now I have the country values populated. How do I add the ALL value
> from here?
> Thanks,|||Can we take this question one step farther? Adding a UNION will make the
word "ALL" appear in the parameter drop down list, but what technique do you
use in the report dataset to implement "ALL" in the WHERE clause?
Is there a better technique than coding:
WHERE (country = @.country OR @.country = 'ALL')
I find that I loose the ability to render the query in the GUI if I use
complex AND/OR combinations in parenthesis.
Thanks in advance.
Randy Howie
"Julian Bowker" wrote:
> Use a union in the original query to add a dummy 'All' record to your
> primary result set. I've used that on many similar occasions.
> Julian Bowker
> Marble Steps Systems
> "et_ck" <etck@.discussions.microsoft.com> wrote in message
> news:0971547C-4373-4AB3-9F57-F4BCFAE44756@.microsoft.com...
> > Hi,
> >
> > I just want to know if is it possible to add a "ALL" value to the drop
> > down
> > list of a parameter field?
> >
> > I can't seem to manually add the "ALL" value after I specify that the
> > parameter's values are taken from a query.
> >
> > For example, I have a parameter, "Country" and its values are taken from a
> > query. Now I have the country values populated. How do I add the ALL value
> > from here?
> >
> > Thanks,
>
>|||That technique is much better than just about any other that I have seen.
Saying that you might prefer to use like and have the value be the wild card
for the database you are going against (for instance % if SQL Server). I.e.
Where (country like @.country)
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Randy Howie" <Randy Howie@.discussions.microsoft.com> wrote in message
news:E849778B-9215-42B2-AC0D-702E0101B6C2@.microsoft.com...
> Can we take this question one step farther? Adding a UNION will make the
> word "ALL" appear in the parameter drop down list, but what technique do
> you
> use in the report dataset to implement "ALL" in the WHERE clause?
> Is there a better technique than coding:
> WHERE (country = @.country OR @.country = 'ALL')
> I find that I loose the ability to render the query in the GUI if I use
> complex AND/OR combinations in parenthesis.
> Thanks in advance.
> Randy Howie
> "Julian Bowker" wrote:
>> Use a union in the original query to add a dummy 'All' record to your
>> primary result set. I've used that on many similar occasions.
>> Julian Bowker
>> Marble Steps Systems
>> "et_ck" <etck@.discussions.microsoft.com> wrote in message
>> news:0971547C-4373-4AB3-9F57-F4BCFAE44756@.microsoft.com...
>> > Hi,
>> >
>> > I just want to know if is it possible to add a "ALL" value to the drop
>> > down
>> > list of a parameter field?
>> >
>> > I can't seem to manually add the "ALL" value after I specify that the
>> > parameter's values are taken from a query.
>> >
>> > For example, I have a parameter, "Country" and its values are taken
>> > from a
>> > query. Now I have the country values populated. How do I add the ALL
>> > value
>> > from here?
>> >
>> > Thanks,
>>|||Hi Julian,
Thanks for the help.
"Julian Bowker" wrote:
> Use a union in the original query to add a dummy 'All' record to your
> primary result set. I've used that on many similar occasions.
> Julian Bowker
> Marble Steps Systems
> "et_ck" <etck@.discussions.microsoft.com> wrote in message
> news:0971547C-4373-4AB3-9F57-F4BCFAE44756@.microsoft.com...
> > Hi,
> >
> > I just want to know if is it possible to add a "ALL" value to the drop
> > down
> > list of a parameter field?
> >
> > I can't seem to manually add the "ALL" value after I specify that the
> > parameter's values are taken from a query.
> >
> > For example, I have a parameter, "Country" and its values are taken from a
> > query. Now I have the country values populated. How do I add the ALL value
> > from here?
> >
> > Thanks,
>
>sql
Added text field to database. New entries not equal to ""
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
>
Added text field to database. New entries not equal to ""
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...
> Thanks!
> "Alan Howard" <Xalan.howardX@.Xparadise.net.nzX> wrote in message
> news:ONCUTnKVEHA.2928@.tk2msftngp13.phx.gbl...
Response.Write[vbcol=seagreen]
response.write[vbcol=seagreen]
>sql
Added a column to my SQL database and now text field will not write to it. Why
I have a web form that is an interface for a database. The code was working fine until a field needed to be added. So I added the new field, updated the data adapter and data set, and when i enter the data into the field, all of the old fields are getting updated, but the new ones aren't. I am at wits end as to why. Can someone please help!!!
I am using VS Studio 2000 ASP.NET and C#. The code is below. The bold items are the new fields.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TrafficDept
{
///<summary>
/// Summary description for AddOwner.
///</summary>
publicclass AddOwner : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Data.SqlClient.SqlDataAdapter daAddOwner;
protected System.Web.UI.WebControls.TextBox tbOtherOwnerLName;
protected System.Web.UI.WebControls.Panel namePanel;
protected System.Web.UI.WebControls.TextBox tbOtherOwnerMI;
protected System.Web.UI.WebControls.TextBox tbOtherOwnerFName;
protected System.Web.UI.WebControls.TextBox tbSecondOwnerLName;
protected System.Web.UI.WebControls.TextBox tbSecondOwnerMI;
protected System.Web.UI.WebControls.TextBox tbSecondOwnerFName;
protected System.Web.UI.WebControls.Button Button4;
protected SiteCubed.EditWorksProfessional tbNote;
protected System.Web.UI.WebControls.Panel notePanel;
protected System.Web.UI.WebControls.DropDownList ddlStatus;
protected PeterBlum.PetersDatePackage.DateTextBox tbRegDate;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.TextBox tbOwner;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox tbOwnerMI;
protected System.Web.UI.WebControls.TextBox tbOwnerLName;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
protected System.Web.UI.WebControls.TextBox tbBusinessName;
protected System.Web.UI.WebControls.TextBox tbAddress;
protected System.Web.UI.WebControls.TextBox tbRegNo;
protected System.Web.UI.WebControls.TextBox tbPreviousOwner;
protected System.Web.UI.WebControls.TextBox tbPOwnerAddress;
protected System.Web.UI.WebControls.TextBox tbPORegNo;
protected PeterBlum.PetersDatePackage.DateTextBox tbTransferDate;
protected System.Web.UI.WebControls.DropDownList ddlMeans;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button2;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected TrafficDept.dsAddOwner dsAddOwner1;
privatevoid Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
privatevoid Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("AddOthers.aspx");
}
privatevoid Button1_Click(object sender, System.EventArgs e)
{
daAddOwner.Fill(dsAddOwner1);
dsAddOwner.OwnershipRow drOwner = dsAddOwner1.Ownership.NewOwnershipRow();
drOwner.Plates_ID =int.Parse(Session["PlatesID"].ToString());
drOwner.Status = ddlStatus.SelectedItem.Text;
drOwner.Current_Legal_Owner = tbOwner.Text;
drOwner.Owner_CurrentLegalOwnerMI = tbOwnerMI.Text.ToString();
drOwner.Owner_CurrentLegalOwnerLName = tbOwnerLName.Text;
drOwner.Owner_CurrentBusinessName = tbBusinessName.Text;
if (!tbRegDate.xIsEmpty)
drOwner.Date_of_Registration = DateTime.Parse(tbRegDate.Text.ToString());
drOwner.Address_of_Current_Owner = tbAddress.Text;
drOwner.Reg_No_for_Current_Owner = tbRegNo.Text;
drOwner.Previous_Owner = tbPreviousOwner.Text;
drOwner.Previous_Owner_Address = tbPOwnerAddress.Text;
drOwner.Reg_No_for_Previous_Owner = tbPORegNo.Text;
if (!tbTransferDate.xIsEmpty)
drOwner.Date_of_Transfer = DateTime.Parse(tbTransferDate.Text.ToString());
drOwner.By_Means_of = ddlMeans.SelectedItem.Text;
drOwner.Owner_SecondaryLegalOwnerFName = tbSecondOwnerFName.Text;
drOwner.Owner_SecondaryLegalOwnerMI = tbSecondOwnerMI.Text;
drOwner.Owner_SecondaryLegalOwnerLName = tbSecondOwnerLName.Text;
drOwner.Owner_OtherLegalOwnerFName = tbOtherOwnerFName.Text;
drOwner.Owner_OtherLegalOwnerMI = tbOtherOwnerMI.Text;
drOwner.Owner_OtherLegalOwnerLName = tbOtherOwnerLName.Text;
drOwner.Owner_Notes = tbNote.Text;
dsAddOwner1.Ownership.Rows.Add(drOwner);
daAddOwner.Update(dsAddOwner1);
Response.Redirect("AddOthersTP.aspx");
}
privatevoid Button3_Click(object sender, System.EventArgs e)
{
//daAddOwner.Fill(dsAddOwner1);
//dsAddOwner.OwnershipRow drAddOwner = dsAddOwner1.Ownership.NewOwnershipRow();
namePanel.Visible =true;
}
privatevoid Button4_Click(object sender, System.EventArgs e)
{
notePanel.Visible =true;
}
}
}
I found my problem. The .dll was never being rebuilt.Monday, March 19, 2012
add to data
I have a database that has a field with phone numbers in.
I want to update the main part of the number to add the area code to
the main number.
I will do a selection on the postcode of the address and then I want to
add the correct area code to the beginning of the number.
Any help please.
SteveHi Steve,
First of all:
http://www.aspfaq.com/etiquette.asp?id=5006
Based on this its hard to give some suggestions but assuming some thing
here is some pseudocode
UPDATE CustomerTable
SET phoneNumber = CAST(RegionCode AS VARCHAR(10)) + CAST(phoneNumber
AS VARCHAR(100))
FROM CustomerTable C
INNER JOIN
RegionPhoeTable R
ON C.ZipCode = R.ZipCode
HTH, jens Suessmeyer.
add to data
I have a database that has a field with phone numbers in.
I want to update the main part of the number to add the area code to
the main number.
I will do a selection on the postcode of the address and then I want to
add the correct area code to the beginning of the number.
Any help please.
Steve
Hi Steve,
First of all:
http://www.aspfaq.com/etiquette.asp?id=5006
Based on this its hard to give some suggestions but assuming some thing
here is some pseudocode
UPDATE CustomerTable
SET phoneNumber = CAST(RegionCode AS VARCHAR(10)) + CAST(phoneNumber
AS VARCHAR(100))
FROM CustomerTable C
INNER JOIN
RegionPhoeTable R
ON C.ZipCode = R.ZipCode
HTH, jens Suessmeyer.
add to data
I have a database that has a field with phone numbers in.
I want to update the main part of the number to add the area code to
the main number.
I will do a selection on the postcode of the address and then I want to
add the correct area code to the beginning of the number.
Any help please.
SteveHi Steve,
First of all:
http://www.aspfaq.com/etiquette.asp?id=5006
Based on this its hard to give some suggestions but assuming some thing
here is some pseudocode
UPDATE CustomerTable
SET phoneNumber = CAST(RegionCode AS VARCHAR(10)) + CAST(phoneNumber
AS VARCHAR(100))
FROM CustomerTable C
INNER JOIN
RegionPhoeTable R
ON C.ZipCode = R.ZipCode
HTH, jens Suessmeyer.
add time to datetime value and split into date and time
Hi
i have the following situation. in my database i have a datetime field (dd/mm/yy hh:mms) and i also have a field timezone.
the timezone field has values in minutes that i should add to my datetime field so i have the actual time.
afterwards i split the datetime into date and time.
the last part i can accomplish (CONVERT (varchar, datetime, 103) as DATEVALUE and CONVERT (varchar, DATETIME, 108) as TIMEVALUE).
could anybody tell me how i can add the timezone value (in minutes) to my datetime value ?
i do all the calculations in my datasource (sql).
Thanks
V.
at the end i found it myself
this is how i solved it.
to add the timezone value (in minutes) to my datetime i used following :
DATEADD(minute, TimeZone, DATETIMEVALUE) AS ACTUALDATETIME
this expression will add the timezone value (example 60) to my current date time value (12/06/2007 08:00:00) and store it in
actualdatetime value (12/06/2007 09:00:00).
from then on it's easy to extract date and time from the result.
CONVERT(varchar, (DATEADD(m,TimeZone,DATETIME)), 103) AS DATEVAL for the DATE
CONVERT(varchar, (DATEADD(m,TimeZone,DATETIME)), 108) AS TIMEVAL for the time.
i thank myself for my research .. lol
Greetings to all