Adding A New Column Is DBNULL
Jun 2, 2007
Hello,
VS 2005
I am developing the database application. This is a live database and is being used by the customer. I am to release a new version and I had to add new columns to fit the requirements DateStarted (DateTime), and TotalHours(Int) into a database table.There are already over a 1000 rows in this table.
When the customer wants to look at a record in this table and insert the value into the text boxes (Front-end), when it gets to the DateStarted or TotalHours it comes up with a error message:"
The value for column 'DateStarted' in table 'IncidentTask' is DBNull."The method for inserting is:
Code Snippet
Me.dtDateStarted.Value = Me.DsIncidentsControl.IncidentTask(0).DateStarted
What are the possible solutions to this problem? Would it mean checking for a DBNULL before displaying in the textboxes? Or updating the new column rows with an date:
Code Snippet
UPDATE IncidentTask SET DateStarted = '1/1/2005' WHERE (DateStarted IS NULL)
Many thanks for any suggestions,
Steve
View 1 Replies
ADVERTISEMENT
Feb 21, 2008
I have quite a few tables which allow NULL values. I have to struggle a lot with DBnull Exceptions :|example: col1,col2,... are all columns of type Integer and possibly NULL. var query = from person in table select new { person.col1, test = (int?) person.col2, person.col3, person.col4, ...}; As soon as my result encounters a DBNull value.. the whole query fails. This is really bad.How would I return the valid values.. and set the keys where there is no value to a null type? (e.g. int -> 0)I tried using "(int?)" but I'm not *really* sure what it does :-) Anyway.. it has no effect :-)
View 1 Replies
View Related
Aug 6, 2013
What is the syntax for adding a column where you are adding a year to a date in a date format? For example adding a column displaying a year after the participation date in date format?
View 1 Replies
View Related
Mar 30, 2004
I simply need the ability using SQL to add columns in an existing table before (or after) columns that already exist.
The MS SQL implementation of ALTER TABLE doesn't seem to provide the before or after placement criteria I require. How is this done in MS SQL using SQL or is there a stored procedure I can use?
Thanks.
View 5 Replies
View Related
Jul 20, 2005
I have two columns in a table:StartDate DateTime and StartTime DateTime.The StartDate column holds a value such as 07/16/2004The StartTime column holds a value such as 3:00:00 PMI want to be able to add them in a stored procedure.When I use StartDate + StartTime I get a date two days earlier than expected.For example, instead of 7/16/2004 3:00:00 PM StartDate + StartTime returns7/14/2004 3:00:00 PM.Can anyone point out wht I'm doing wrong with this one?Thanks,lq
View 2 Replies
View Related
May 2, 2014
I have a query like following
SET NOCOUNT OFF
SET ROWCOUNT 0
DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = CAST (DATEDIFF(d, 0, DATEADD(d, 1 - day(getdate()), getdate()))as datetime)
SET @EndDate = GetDate()
[Code] ....
and when i execute it, it gave a return that i expected, but then i want to add a date column on the first column.
View 5 Replies
View Related
Oct 8, 2007
How can I test to see if a column exists before adding a column to a sql mobile table?
thanks,
Luis
View 1 Replies
View Related
May 3, 2007
As a part of migration to .net we are redesigning sql server 7 database and moving it to sql server 2005. There are a lot of fields with dbnull value in the existing db. It would be nice to populate them with some default value while transfering data to the new datbase on sql server 2005.
What is the best way to deal with the issue, are there any possible drawbacks and problems.
Your input will be greatly appreciated.
View 1 Replies
View Related
Jan 10, 2008
Hello!
Is there an easy way to deal with this situation below when reading in data from a SQL Database:
int? myNullableColumn;myNullableColumn = Convert.ToInt32(datarow["datacolumn"]);
Where, ideally, 'myNullableColumn' would be 'null' if the value was 'DBNull.Value'. This does not work because Convert.ToInt32 will not convert 'DBNull.Value to null', but instead throws an error.
Is there a built in funtion that does do this?
Thanks!
View 8 Replies
View Related
Jan 26, 2004
Hello,
If I have a database table with column that can accept null values and I want to insert a null value into that column, what is the correct syntax?
db_cmd = New SqlCommand( "sp_stored_procedure", db_connection )
db_cmd.CommandType = CommandType.StoredProcedure
db_cmd.Parameters.Add( "@col_to_set_to_null", ??? )
ie: what expression can be used for "???"
Ideally, I want to check if a string value is empty and if so insert a null, but I have yet to see any examples, ie:
if ( str.empty ) then
insert DBNull.value into column
else
insert str into column
end if
Sincerely,
Brent D.
View 1 Replies
View Related
Apr 2, 2007
Am getting errors on this syntax:
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Row.myColumn = DBNull.Value
Value of type 'System.DBNull' cannot be converted to type 'String'
Any ideas? Just want to set the myColumn to NULL.
Thanks
View 1 Replies
View Related
May 5, 2008
Hi,I have an application up and running. I need to add a new column to one of the tables which is currently being used - would adding a new column change or cause errors in the current application? e.g. if the table is being accessed by selecting * from table, will adding a new column cause an error? If there is any circumstance where an error would be caused by adding a new column, I will have to create an entirely new table. If I have to do this - how do I get a column in the new table to have the same values as a column in the old table? Can I create a computed column where column=oldcolumn? Thanks,Jon
View 5 Replies
View Related
Jun 15, 2007
hi guys! I have a table with 3 columns but i realized that i need to add 1 column between column 2 and 3. Can anybody please help me on how to do that? Thanks in advance!
View 2 Replies
View Related
Jul 5, 2007
ALTER TABLE BFTITLE ADD COLUMN [RATETYPE] [NUMERIC] (10) NOT NULL ;
syntax is not working so can any one tell the right syntax
View 3 Replies
View Related
Mar 20, 2007
Sanjeev Dhiman writes "Sir,
How I can add a new column between existing two column...?
Sanjeev Dhiman"
View 2 Replies
View Related
Sep 12, 2005
Suppose I have a table with the following columns: Year, SalesInEurope,SalesInAmerica, TotalSales. I want to add a new column calledSalesInAsia, say, but I want it to appear before TotalSales. How canthis be achieved?Thanks,Bruno
View 13 Replies
View Related
Oct 26, 2006
Hi
I have a column with times in
845
930
1015
1145
I need to update the column to look like this:
08:45
09:30
10:15
11:45
thanks in advance
rich
View 1 Replies
View Related
Mar 11, 2004
Hi
I have only been coding in .Net for about six months, and am not sure if this is a C# problem or an SQL one. I use the Data Access Application Block in my program.
I have two optional fields on my form (RangeFrom and RangeTo). If the user chooses not to enter data into these textboxes(textbox = ""), an entry on the db is created with null values. It works.
But sometimes the user wants to enter 0 as either an upper or lower end of a range. This is where my problem comes in. My program saves 0 as null too.
In my program I do a test on the textboxes and populate two float values in a business object (objQuestion) accordingly, like this:
if (txtrangefrom.Text != "") {
objQuestion.RangeFrom=float.Parse(txtrangefrom.Text);
objQuestion.RangeTo=float.Parse(txtrangeto.Text);
}
else {
objQuestion.RangeFrom=Convert.ToSingle(null);
objQuestion.RangeTo=Convert.ToSingle(null);
}
And this is what my Business object look like. It sets up the parameters and calls the Data Access Application Block to create an entry in my table:
// fieldslist
float cvintRangeFrom;
float cvintRangeTo;
//properties
public float RangeFrom {
get {
return cvintRangeFrom;
}
set {
cvintRangeFrom = value;
}
}
public float RangeTo {
get {
return cvintRangeTo;
}
set {
cvintRangeTo = value;
}
}
// some code deleted for readability....
public int AddOption() {
string cvstrSpName = "addOption";
SqlParameter [] cvstrStoredParams = SqlHelperParameterCache.GetSpParameterSet(gcstrConnectionString, cvstrSpName, true);
//lines deleted for readability...
//check if the optional fields have a value associated with them. if not, assign dbnull.value.
cvstrStoredParams[4].Value=(cvintRangeFrom != Convert.ToSingle(null) ? cvintRangeFrom : (object)DBNull.Value);
cvstrStoredParams[5].Value=(cvintRangeTo != Convert.ToSingle(null) ? cvintRangeTo : (object)DBNull.Value);
//lines deleted for readability...
SqlHelper.ExecuteNonQuery(gcstrConnectionString, CommandType.StoredProcedure, cvstrSpName, cvstrStoredParams);
return(cvintOptionID = Convert.ToInt32(cvstrStoredParams[0].Value));
}
I use Convert.ToSingle when working with nulls (or possible nulls) because I get an error when I use float.parse for this.
The thing is, after this method AddOption has been executed, I test the value if the business object's rangefrom (that is where I entered 0) and display it on my form. I still shows a 0, but on my database table it is null!
objQuestion.AddOption();
//txtrangefrom.Text=""; on the next line I test the value in the business object...
txtrangefrom.Text=objQuestion.RangeFrom.ToString(); // and this displays 0!!!
//txtrangeto.Text="";
txtrangeto.Text=objQuestion.RangeTo.ToString();
So to me it seems the problem seems to be either the DAAB or on the SQL side, but hopefully somebody can prove me wrong! I was thinking that it could also be float.parse/Convert.ToSingle methods and have done various tests, but I am none the wiser...
Any help or ideas will be greatly appreciated...
View 2 Replies
View Related
Jan 3, 2006
I haven't tested it, because at the moment I can't access my SQL database
I know this is probably a stupid question, but...How can I test for DBNull when I'm using SqlDataReader.Item(string)?
I use to check it using: if(!reader.IsDBNull(2)) ...But I have found that can not count on a particular ordinal reference because some of the stored procedures select the columns in different orders.
can I do something like: if(reader["Column1"] != DBNull.Value)or with the reader["Column1"] throw an error because it is not found??
I too hate when people ask questions that they could test themselves...but I can't really test it at the moment. Any input would be greatly appreciated.
View 2 Replies
View Related
Feb 5, 2006
Hi!
I was trying to use the ?? operator with an DBDatareader. eg:
long lValue = Convert.ToInt32(objReader["ParentID"] ?? -1);
which throws the following exception: "... Object cannot be cast from DBNull to other types."I think the reason is, that DBNull.Value isnĀ“t actually null. Therefore I changed my code to:
long lValue = objReader["ParentID"] != DBNull.Value ? Convert.ToInt32(objReader["ParentID"]) : -1;
Is there a better way of doing this ? Can one use the ?? operator with a Datareader anyway?
Thanks for your help!
PS: sorry for my poor english.
View 2 Replies
View Related
Apr 24, 2006
Hi,
I have built a few pages and a stored procedure and a class on the back of a SQL2000 dbase. and I get the following error:
Cast from type 'DBNull' to type 'String' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.Source Error:
Line 111: Dim myWorkJobs As WorkJobsDATA = New WorkJobsDATA
Line 112:
Line 113: myWorkJobs.CustomerID = CStr(parameterCustomerID.Value)
Line 114: myWorkJobs.WorkID = CStr(parameterWorkID.Value)
Line 115: myWorkJobs.DateOfQuote = CStr(parameterDateOfQuote.Value).Trim()
Source File: C:InetpubwwwrootCommerceComponentsWorkJobs.vb Line: 113
My Database has 1 line of data (for testing) and all fields are populated. I am Querying a column called IndividualID which has a value of 3425243 at the moment. This is hardcoded in the aspx.vb at the moment.
ASPX VB:
Public Class WorkRequest Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
'for now, send this value (stored in dbase under individualID) to the querystring
Dim IndividualID As String = "3425243"
Response.Redirect("WorkRequestMain.aspx?IndividualID=" & IndividualID) End SubEnd Class
COMPONENTSWorkJobs.vb (This is the class file)
Imports SystemImports System.ConfigurationImports System.DataImports System.Data.SqlClient
Namespace ASPNET.StarterKit.Commerce
Public Class WorkJobsDATA
Public CustomerID As String Public WorkID As String Public DateOfQuote As String Public QuoteAmount As String Public Title As Decimal Public FirstName As String Public Surname As String Public FirstLine As String Public District As String Public Town As String Public Postcode As String Public Telephone As String Public Requirements As String Public WorkRequired As String Public EmailAddress As String
End Class
Public Class WorkJobs
Public Function GetWorkDetails(ByVal IndividualID As String) As WorkJobsDATA
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim myCommand As SqlCommand = New SqlCommand("SP_PendingQuotes", myConnection)
' Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure
' Add Parameters to SPROC Dim parameterIndividualID As SqlParameter = New SqlParameter("@IndividualID", SqlDbType.NVarChar, 50) parameterIndividualID.Value = IndividualID myCommand.Parameters.Add(parameterIndividualID)
Dim parameterCustomerID As SqlParameter = New SqlParameter("@CustomerID", SqlDbType.BigInt, 8) parameterCustomerID.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterCustomerID)
Dim parameterWorkID As SqlParameter = New SqlParameter("@WorkID", SqlDbType.NVarChar, 50) parameterWorkID.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterWorkID)
Dim parameterDateOfQuote As SqlParameter = New SqlParameter("@DateOfQuote", SqlDbType.DateTime, 8) parameterDateOfQuote.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterDateOfQuote)
Dim parameterQuoteAmount As SqlParameter = New SqlParameter("@QuoteAmount", SqlDbType.Money, 8) parameterQuoteAmount.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterQuoteAmount)
Dim parameterTitle As SqlParameter = New SqlParameter("@Title", SqlDbType.NVarChar, 50) parameterTitle.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterTitle)
Dim parameterFirstName As SqlParameter = New SqlParameter("@FirstName", SqlDbType.NVarChar, 50) parameterFirstName.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterFirstName)
Dim parameterSurname As SqlParameter = New SqlParameter("@Surname", SqlDbType.NVarChar, 50) parameterSurname.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterSurname)
Dim parameterFirstLine As SqlParameter = New SqlParameter("@FirstLine ", SqlDbType.NVarChar, 50) parameterFirstLine.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterFirstLine)
Dim parameterDistrict As SqlParameter = New SqlParameter("@District", SqlDbType.NVarChar, 50) parameterDistrict.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterDistrict)
Dim parameterTown As SqlParameter = New SqlParameter("@Town", SqlDbType.NVarChar, 50) parameterTown.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterTown)
Dim parameterPostcode As SqlParameter = New SqlParameter("@Postcode", SqlDbType.NVarChar, 50) parameterPostcode.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterPostcode)
Dim parameterTelephone As SqlParameter = New SqlParameter("@Telephone", SqlDbType.NVarChar, 50) parameterTelephone.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterTelephone)
Dim parameterRequirements As SqlParameter = New SqlParameter("@Requirements", SqlDbType.NVarChar, 3500) parameterRequirements.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterRequirements)
Dim parameterWorkRequired As SqlParameter = New SqlParameter("@WorkRequired", SqlDbType.NVarChar, 3500) parameterWorkRequired.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterWorkRequired)
Dim parameterEmailAddress As SqlParameter = New SqlParameter("@EmailAddress", SqlDbType.NVarChar, 100) parameterEmailAddress.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterEmailAddress)
myConnection.Open() myCommand.ExecuteNonQuery() myConnection.Close()
parameterEmailAddress.Value.GetType()
Dim myWorkJobs As WorkJobsDATA = New WorkJobsDATA
myWorkJobs.CustomerID = CStr(parameterCustomerID.Value) myWorkJobs.WorkID = CStr(parameterWorkID.Value) myWorkJobs.DateOfQuote = CStr(parameterDateOfQuote.Value).Trim() myWorkJobs.Title = CStr(parameterTitle.Value).Trim() myWorkJobs.FirstName = CStr(parameterFirstName.Value).Trim() myWorkJobs.Surname = CStr(parameterSurname.Value).Trim() myWorkJobs.FirstLine = CStr(parameterFirstLine.Value).Trim() myWorkJobs.District = CStr(parameterDistrict.Value).Trim() myWorkJobs.Town = CStr(parameterTown.Value).Trim() myWorkJobs.Postcode = CStr(parameterPostcode.Value).Trim() myWorkJobs.Telephone = CStr(parameterTelephone.Value).Trim() myWorkJobs.Requirements = CStr(parameterRequirements.Value).Trim() myWorkJobs.WorkRequired = CStr(parameterWorkRequired.Value).Trim() myWorkJobs.EmailAddress = CStr(parameterEmailAddress.Value).Trim()
Return myWorkJobs
End Function
End ClassEnd Namespace
And finally my stored procedure:
CREATE Procedure SP_PendingQuotes( @IndividualID nvarchar, @CustomerID bigint OUTPUT, @WorkID nvarchar(50) OUTPUT, @DateOfQuote datetime OUTPUT, @QuoteAmount money OUTPUT, @Title nvarchar(50) OUTPUT, @FirstName nvarchar(50) OUTPUT, @Surname nvarchar(50) OUTPUT, @FirstLine nvarchar(50) OUTPUT, @District nvarchar(50) OUTPUT, @Town nvarchar(50) OUTPUT, @Postcode nvarchar(50) OUTPUT, @Telephone nvarchar(50) OUTPUT, @Requirements nvarchar(3500) OUTPUT, @WorkRequired nvarchar(3500) OUTPUT, @EmailAddress nvarchar(100) OUTPUT)AS
SELECT @IndividualID = IndividualID, @CustomerID = CustomerID, @WorkID = WorkID, @DateOfQuote = DateOfQuote, @QuoteAmount = QuoteAmount, @Title = Title, @FirstName = FirstName, @Surname = Surname, @FirstLine = FirstLine, @District = District, @Town = Town, @Postcode = Postcode, @Telephone = Telephone, @Requirements = Requirements, @WorkRequired = WorkRequired, @EmailAddress = EmailAddress
FROM PendingQuotes
WHERE IndividualID = @IndividualIDGO
Any ideas anyone?
I appreciate this is a big amount of data, but if anyone wants to chat to me i'm available on MSN Messenger under wolvokid@msn.com
View 2 Replies
View Related
Jul 20, 2005
Dear GroupI'm having a very weird problem. Any hints are greatly appreciated.I'm returning two values from a MS SQL Server 2000 stored procedure to myASP.NET Webapplication and store them in sessions.Like This:prm4 = cmd1.CreateParameterWith prm4..ParameterName = "@Sec_ProgUser_Gen"..SqlDbType = SqlDbType.VarChar..Size = 10..Direction = ParameterDirection.OutputEnd Withprm5 = cmd1.CreateParameterWith prm5..ParameterName = "@Sec_ProgUser_Key"..SqlDbType = SqlDbType.VarChar..Size = 10..Direction = ParameterDirection.OutputEnd With....cmd1.ExecuteNonQuery()....Session("Sec_ProgUser_Gen") = prm4.ValueSession("Sec_ProgUser_Key") = prm5.ValueBoth output parameters are declared as varchar(10) within the storedprocedure. If I run the stored procedure in SQL Analyzer, I'm getting astring value for each of them. E.g. @Sec_ProgUser_Gen is "1110011",@Sec_ProgUser_Key = "1100".Now the strange thing happens if I try to run the following code:Sub MyTest()Dim MyString1 As StringDim MyString2 As StringMyString1 = CStr(Session("Sec_ProgUser_Key"))....MyString2 = CStr(Session("Sec_ProgUser_Gen"))End SubIt fails in line 'MyString2 = CStr(Session("Sec_ProgUser_Gen"))' with Castfrom type 'DBNull' to type 'String' is not valid.I don't understand this. They are both the same, the only difference is thelength of the string. Help!Additional Information:The values for @Sec_ProgUser_XXX are created in the stored procedure with astatement like this:SET @Sec_ProgUser_Key = (SELECT Convert(varchar(1),Key_CanCreateKey) +Convert(varchar(1),Key_CanCreateTransaction) +Convert(varchar(1),Key_CanView) + Convert(varchar(1),Key_CanDelete) FROMi2b_proguser_securityprofile WHERE SecurityProfileID = @SecurityProfileID)The datatype of the source columns used to be bit then changed them toInteger as I thought this might cause the problem. (Although it shouldn't asthe values get converted to varchar without a problem in the storedprocedure. No fields contain NULL values, only 1 or 0.
View 1 Replies
View Related
May 23, 2006
How to set NULL values inside VB Script .Net?? Both causes error:
.FECHAAP = NULL
.FECHAAP = System.DBNull
View 3 Replies
View Related
Dec 27, 2006
I have a sp: mysp_getstuff it contains the following:SELECT Adress,City FROM tblUserData WHERE UserName='john'as you can see it returns 2 columns.I also have another SP: mysp_GetNr. This sp returns an integer.I want to call mysp_getnr from mysp_getstuff and add the result to the 2 columns in a column named 'Number'So the resultset from mysp_getstuff should be:Adress, City, Number (in which the number column contains the result from mysp_GetNr)How can I do that?
View 1 Replies
View Related
Oct 13, 2005
I posed this problem a few days ago, but havent been able to generate the results i need. Suppose my resultset from an sql query gathering totalsales for a given day by a salesrep looks like this:Lastname totalsales orderID-----------------------doe 1403 510doe 500 680 doe 200 701using SUM(Accounts.totalsales) is not adding up the totalsales. What do I need to do to add up the totalsales, and then reassign it to a newfield?netsports
View 8 Replies
View Related
Jun 6, 2006
I have been working on a website in asp.net1.1 in vb.net2003. I am using a sql2000 server. I am attempting to add a column to my datagrid that will add the total number of wins and output the number in that colum. With some help, I have been able to write the code. However, I am not sure where to put it. Is it a sql function I need to call from my code to add to the win column? Thanks for your help.
View 1 Replies
View Related
Dec 18, 2001
I have a table size 2078mb, number of row +530,900. Is it normal for sql to lock users out of the db when I add a column to the end of the table? I'm running SQL 7.0. The table has 4 col regular indexes. No primary keys. It locked the user out for about 10 min. I thought with SQL 7.0 this problem went away?
View 1 Replies
View Related
Mar 26, 2002
Hello Everybody
We have a SQL Server 6.5 with SP 5a . I want to add an additional column in one of the tables of a database .
Since i don't have much experience on SQL 6.5 , i need your precious help in resolving this case .
Can somebody help me in this regard in a detail step wise manner ? Enterprise manager does not have facility to add new columns to an existing table in SQL 6.5 .
I want to add a Column called 'DM ' with datatype as 'bit' with size as 1 and as non nullable .
Any kind of help will be very precious to me .
Thank you all in advance.
Regards
Rita.
View 5 Replies
View Related
May 16, 2002
This is a very simple select but I would like to add a final column that adds the QOH, QOB, QOO and Quantity. How can I accomplish this? Thanks
SELECT DISTINCT
zcus_MM_Medsurg_Used.stock_no,
zcus_MM_Medsurg_QOH_Only.qty_on_hand AS QOH,
zcus_MM_Medsurg_Used.QOB,
zcus_MM_Medsurg_Used.QOO,
zcus_MM_Medsurg_Used.QUANTITY
FROM
zcus_MM_Medsurg_QOH_Only INNER JOIN
zcus_MM_Medsurg_Used ON
zcus_MM_Medsurg_QOH_Only.stock_no = zcus_MM_Medsurg_Used.stock_no
View 1 Replies
View Related
Feb 24, 2003
Can I add a column to a database table without dropping and recreating the table?
The problem is that everytime a user creates an action that requires a new table - at the moment I drop the table and recreate the table with the new column.
This requires lots of resources as I have to populate the table again.
Is there a design way I can go around this?
View 5 Replies
View Related
Jul 7, 2004
I previously posted about a problem where I added a non-NULL DEFAULT 0 bit column to a table with 80 million records. It was taking a LONG time and we needed that database up fast. It ended up taking a total of 17 hours.
Now my coworker added the same non-NULL DEFAULT 0 bit column to another table on another important server. But this table has more like 400 million rows. It's been running for 100+ hours and is still going. We were hoping it would scale linearly (5*80 million records would hopefully take 5*17 hours) but that isn't happening. I have no idea how much longer it will take. I really need this to be done. I'm tempted to cancel but that will incur a potentially massive rollback, right? Any guestimate on how large that would be?
Any ideas?
View 9 Replies
View Related
Jan 20, 2004
Hi,
I would like to alter a table in a sql server database then update the column with data in the same script. However, the database does not recognize the database column if I create it within the script. Is there a way to refresh this within the script so that I can run this in one procedure? If I create the table in one script then update in a second script it will work. Thanks.
Laura
View 5 Replies
View Related
Oct 29, 2013
I have a pretty simple SQL query that has two columns that contains only numbers. Is there a way i can add an extra column that simply subtracts the number in one column from number in the other column.I query the data tables rather than have a live link so the .csv file gets overwritten every time i run the query.
View 4 Replies
View Related