Computing Values From Two Tables

May 11, 2008

Hello all!

I´m currently devoloping an application where users can register errors related to recieved purchase orders.
I store these values in i table where the purchase order id i PK, and the possible errors that
can exist are stored as bit.

Now I want to be able to put a price on these errors.
I´m thinking about adding another table, containing all possible errors as columns, and then storing the cost of each error as an integer, and probably also a datetime for keeping track of when the costs was last updated.

I´m pretty sure this problem has been solved alot of times before, so I don´t wanna do something stupid here :-)

I´m also wondering about how it would be best to show the computed values?
Should I use a view for this?

For example:

SELECT (dbo.Orders.QuantityError * dbo.Costs.QuantityError )
FROM dbo.Costs CROSS JOIN
dbo.Record

assuming now that the Costs table only contains one row.

Is this the right way to go, or can you guys give me hints to a better solution?

Regards

Daniel

View 4 Replies


ADVERTISEMENT

Storing A Value, Vs Computing A Value

Sep 5, 2007

Hi,

I'm having a DB designed for me, and I'm inspecting it and wondering what in general is the better way to do this.

We have a product, which we are counting "product views". The DB designer has created columns called "view_today" and "views_alltime".

I specified I wanted a normalized database, I'm thinking this is technically not normalized ? Am I correct ?

Wouldn't it be better to have a query that counted the views off the logging table ? I can't see any advantage to doing it the way its been designed except to save time.

Thanks for any input !

Mike123

View 3 Replies View Related

Grid Computing

Jul 20, 2005

Has anyone here heard or come across an article or write up about GridComputing in SQL Server 2000?Bharathihttp://www.vkinfotek.com

View 2 Replies View Related

Computing The Queried Output

Mar 11, 2008

hi please help me,i have a table queried using this sql,  select name,(select count(*) from myTable a where a.name = r.name ) as Total, (select count(*) from myTable b where b.name = r.name and dnum > '1') as Used, (select count(*) from myTable c where c.name = r.name and dnum < '1') as remainingfrom myTable r group by namebut i need one more thing in this table that should look like this,nameTotalUsedRemainingPercentageA126650%B2021810%C150150%  this is to add the BOLD field from the above table, but my problem is that the computation is "Used / Total = Percentage%"so how can i do this, please help methanks 

View 4 Replies View Related

Computing 'SUM' On 'DATETIME' Datatype

Jan 5, 2006

hi everybody,
i'm trying to calculate the 'SUM' of time spent in hrs. n min. How can i do this using SQL Server?
What i mean is, i've a column 'TIME_SPENT' that has 'datetime' datatype. This column saves time spent for an activity in format 'hh:mm'. Suppose a user spends 45min for activity 'A' and say 1hr 25 min for activity 'B' then i want to calculate the 'SUM' of 'TIME_SPENT' for the user which should appear as 'Total time spent =2:10'

Can somebody pls help me with this?

Thnx in advance.

View 5 Replies View Related

Computing Business Hours

Mar 16, 2004

I am attempting to compute Service Levels for an interaction based upon business hours. For example, an email arrives at 4pm and is handled the following day at 10am. Call Center Hours are 8-5.

Essentially I have a number of different alternatives, and have found some potential solutions, including:

www.dbforums.com/arch/7/2003/9/914261

However, my situation has a couple of additional twists to the standard 8hrs of business M-F. The call center is open different hours depending upon the day of the week. For example, 8-5 M, 10-7 T, 8-5 W Th F, 10-2 Sat, 10-12 Sun

Additionally, I would like to remove Holiday's from the calculation for service level as well.

I have explored a number of different table DTD's, but none seem to be a perfect fit for determining the number of "open" hours between when an interaction arrived, and when it was handled.

The DTD I have for the Holiday table is as follows:

CREATE Table Holidays (HolidayDate DateTime)
GO
Insert Into Holidays (HolidayDate) Values ('12-25-2004')


Please let me know what you feel would be the DTD for storing the business hours and also the query for extracting the number of Open hours between two dates

Thank you in advance

View 13 Replies View Related

Computing Difference Between Two Rows

Jul 6, 2013

I encountered a tricky problem. The original data, say, table_o, is shown below:

IdsStatusDate
ID1402-May-13
ID1310-May-13
ID1216-May-13
ID1120-May-13
ID2308-May-13
ID2210-May-13
ID2119-May-13

The final resulting table, e.g., table_f, is:

Ids4->3 3->2 2->1
ID18 6 4
ID2NULL 2 9

The values in the final table are the days used by each ID transferring from status i to status i-1. E.g., ID uses 8 days (10-May-13 - 2-May-13) to go to status 3 from status 4.

It is hard for me to come up with a table like the final table, although I know that the difference between two adjacent rows can be computed by using self-join and timediff().

View 3 Replies View Related

Computing New Variable From Other Variables

Sep 6, 2007

Dear All.
I'm a fairly new SQL programmer so apologies if this is a silly question.

I'm trying to create a new column/variable from 3 other variables where the new column = column 1 unless column 1 is blank, then = column 2, unless column 2 is blank, then = column 3.

But I don't know where in my query to begin building this. Should I build it in a subquery? Thanks in advance for any replies.

View 2 Replies View Related

Computing The Sum Of Multiple Columns

May 17, 2008

Hi,

I want to create a view where I can calculate the sum of a couple of bit value columns,
aswell as keeping track of the total number of bits set to true.

Here is an example:





dbo.Band


BandID int
Name nvarchar(50)
Country nvarchar(50)




dbo.Record


ID int
Name nvarchar(50)
BandID int
Label nvarchar(50)
InProduction bit
InSkodne bit
From these tables I created this view:





dbo.TestView


SELECT dbo.Band.Name, dbo.Band.Country, dbo.Record.Name AS Recordname, dbo.Record.Label, CONVERT(int, dbo.Record.InProduction) AS InProduction,
CONVERT(int, dbo.Record.InSkodne) AS InSkodne, CONVERT(int, dbo.Record.InProduction) + CONVERT(int, dbo.Record.InSkodne) AS Total
FROM dbo.Band INNER JOIN
dbo.Record ON dbo.Band.BandID = dbo.Record.BandID
I use the convert function to be able to use SUM() across my bit columns, which works fine. Problems is I´m not sure that the way I´m creating the TOTAL column is the best way to go. Any other ideas?
I´m having some problems using this view and the TOTAL column in particular when referencing this view from applications outside SQL Server...

View 9 Replies View Related

Computing Full Record Row Size

Dec 19, 2001

Is there a quick easy way to calculate rowsize for a record in a table that has data in each column?

View 5 Replies View Related

Problems With Computing A Primary Key Column

Sep 13, 2006

hi !

Just started playing around with SQL 2000 and I createda sample table called 'actor' which has 4 columns

1. actorID
(formula= LEFT(NEWID(), 3)+ LEFT([actorFirst], 2) +
LEFT([actorLast], 2) + RIGHT(NEWID(), 3))
2. actorFirst
varchar(20) NOT NULL
3. actorLast
varchar(20) NOT NULL
4. actorName
(formula = [actorFirst] + ' ' + [actorLast]

Now my problem is that I want to set a primary key constraint on actorID but it doesn't let me because it the NULL check mark is automatically checked and I cannot check it off ... and I can't set a primary key on something which is allowed to be NULL....

I don't understand why 'actorName' column which is also calculated doesn't have that default NULL checked and locked ....

What am I doing wrong ? Please help ....

View 5 Replies View Related

Is Oracle 10g Really Oriented For Grid Computing?

May 8, 2007

Hello all, I known this is a SQL Server forum, but some people maybe have worked with oracle and can help me.



Microsoft's article "http://www.microsoft.com/sql/prodinfo/compare/oracle/mythandreality.mspx :"

reads as follows:



"Oracle's purported Grid enablement in 10g is based on its Oracle Real Application Clusters (RAC) technology that is no more than a local cluster. RAC is a local cluster of computers with no geographic distribution capabilities. This marketing campaign relabeled existing features to exploit current industry trends. "



My question is how can I support the above paragraph? I would like to known more reasons about why oracle grid is a local cluster instead of grid computring oriented.



Thanks in advance.

Hernán.

View 1 Replies View Related

Transact SQL :: Computing Column Formatted To Decimal (12, 2)

Oct 19, 2015

I have the following a computing column

(isnull(TotalProductSaleCost,0) * 7) / 100

I would like the output to be formatted to decimal (12, 2) not sure how to achieve this?

View 4 Replies View Related

Computing And Assigning A Value To A Textbox From Other Data Regions

May 18, 2007

I am new to SSRS, so perhaps its a trivial question. I was wondering that since all controls have names in the report, is it possible to programatically access values of different textboxes, do some computation and then assign to another text box? I know how to do it using the Aggregate functions and operators, but am not sure if I can access values from textboxes within two different tables and assign the computed value to a third text box on the page (not belonging to any table or other control).



somethig like.... txtTotal.Value = FormatCurrency(txtSalesTotal.Value) - txtDiscount.Value));



Any ideas??



DNG.

View 6 Replies View Related

Computing Basic Totals In A Proportional Line Graph

Apr 22, 2008

Hello,I am in the process of making a very simple stats page that will show us how many tasks we've completed.  Here is what I have so far:     Here is the SQL that makes it work:  SelectCommand="SELECT                            Count(TicketID),                           Category                                               FROM                              Tickets                                               GROUP BY                              Category                                                ORDER BY                                Count(TicketID)                             DESC  ">My problem is with how the totals seem to go on forever.  Instead of being in proportion to each other as a percentage of a the total amount of tickets.. they just increase in size with each additonal entry.  Can someone help me restructure this so that I can calculate the totals individually and as a whole and then apply the totals to create a proportional bar graph?Thank you greatly for your help,Mark 

View 2 Replies View Related

Getting Values From Other Tables

Sep 22, 2004

Howdy all. I've tried to figure this out on my own, but alas!, I keep hitting a brick wall.
I'm making a game score "keep-tracker" (very technical jargon, I know...) and so I've set up 3 tables:

Table 1: Players
Columns: PlayerID, PlayerName, Paid

Table 2: Contestants
Columns: ContestantID, ContestantName, Eliminated

Table 3: Picks
Columns: PlayerID, Pick1, Pick2, Pick3, etc...

For Players and Contestants tables, the IDs are int, the names are nvarhars, and Paid/Eliminated is boolean (bit).

Now, I'm trying to display in a datagrid using ASP.NET 1.1, the PlayerName along with the Picks that they have chosen.

I've created a stored proc as follows:

CREATE PROCEDURE GetPicks AS
SELECT
Players.PlayerName,
Picks.Pick1,
Picks.Pick2,
Picks.Pick3,
Picks.Pick4
FROM
Picks, Players, Contestants
WHERE
Picks.PlayerID = Players.PlayerID AND Picks.Pick1 = Contestants.ContestantID
ORDER BY
PlayerName
GO



The result I'm getting is:

PlayerName Pick1 Pick2 Pick3 Pick4
Bob 1 3 5 12
Charlie 1 3 16 17
Wilma 4 7 9 14


The PlayerName appears, rather than PlayerID, which is good to see, but my question is: how can I get the ContestantName to appear as Pick1, Pick2, etc., instead of the integer?

I've tinkered around with JOINs, but I'm a beginner and I'm finding JOINs a bit confusing...
Help would be appreciated! Thanks for your help in advance...

JP

View 3 Replies View Related

Values In Tables

Feb 22, 2001

In the web pages like everbody I'm adding values like "all selections" or "no selection" for select boxes manually. After this manual addition I add the database results within a loop like States.

Is it OK to add manual selection entires to database with a ID value of 0 like below;
StateID State
------- -----
0 Not Selected
1 NY
....

and then using in web page without any manual entries. Also is this kind of entry can be better for indexing and Foreign Key usages.

Thanks in advance.

View 2 Replies View Related

&&<&&> Values From Two Tables

Mar 27, 2008

I have two tables, A & B I need to compare 4 columns in table B with one column in table A. The data returned should only be the values which are not equal values in a column in table A

For example:
row 1 of columns 1, 2, 3, 4 in table B have values 1001, 1001, 1002, 1003
row 2 of columns 1, 2, 3, 4 in table B have values 1001, 1008, 1009, 1007
Table A has a column 1 which has many rows which may contain the values 1001, 1002 etc... but does not have the value 1008. It would then return row 2 as the value in column 2 of table B does not exist in table A column 1.

Any help would be much appreciated

View 7 Replies View Related

Adding Sql Values From 2 Tables

Feb 15, 2007

Hello all, i have 2 sql tables, and they each contain a column with bigint values. What i want to do is add up the values from both table, and then display it as 1 number. Supposing i have the following
table name: DownloadTable
fileName | DownloadSize |
file1       | 45
file2       | 50
file3       | 20
---------------------------------------------
 second table
table name: VideoTable
fileName | VideoSize |
file1       | 40
file2       | 60
file3       | 20
----------------------------------------
Now, i want this to output 120, wich is the sum of the sum of the values of table 1 and 2 I've already tried the following:
SELECT SUM(DownloadTable.DownloadSize) + SUM(VideoTable.VideoSize) FROM DownloadTable, VideoTable
However, when i ran this, it gave me a huge number, that was far from accurate from what it was suppose to output. Can anyone help me?
Thanks in advance
Regards,

View 8 Replies View Related

How To Obtained Values In 2 Tables

Oct 10, 2005

Hii'm fairly new to sql....i know the basic..........what i am trying to do is get values from 1 tables and insert it into another table using a store procedure........              

View 12 Replies View Related

Default Values In Tables

Oct 26, 2000

Does anyone know if or how I can insert a default value of the (+) character into a column? when I try to save it I get an error message saying it has a problem with ')'.

View 1 Replies View Related

INSERT From Different Tables And Values

Oct 18, 2006

Hello

for MS SQL 2000

I am having MyTable with 7 columns : A,B,C,D,E,F,G

i want to

INSERT INTO myTable
SELECT A,B,C,D FROM FirstTable WHERE FirstTable.ID > 100

and the columns E,F,G :
E = 1
F = SELECT Max(ID) AS F FROM SecondTable
G = 0

how can i do it ?
i would like to create a stored procedure

thank you

View 2 Replies View Related

Help Dividing Two Values From Different Tables.

Jul 14, 2007

Hi, I am completly new in ASP , but, due the necessity of the production in the company I work, I need
urgently to learn do deal with scripts and SQL.

I did a script that shows on the production screen the consume tax of the gas instantly on time and it

worked. Now I have to do a table formed by the DIVISION of a valor V from one table by the valor V in

another table, mas the values must be taken at the same time do give me the gas consumed by ton produced.

Explaining in details:

I have two tabels:

1 - PDE#HD#Consumption#RP_Consumption_Gas
2 - PDE#HD#SpeedCurves#Productivity

Inside each of these tables, there are two columms with the same name for both -> V, T. The V columm of the

table PDE#HD#Consumption#RP_Consumption_Gas gives me the cas consumed and the V table of

PDE#HD#SpeedCurves#Productivity the productivity. The V1/V2 graph must be ploted in a 24 hours period. What

happens is that if I do it for 24 houres, I mean, 1 day, the graph is ploted completly wrong in time! If I

do the same thing, but using only one columm, not the division by another, it works! Why this is happening ?

What is wrong with the following script ?? I need to know the answer for this as fast as possible! If you

need more details, I will give.

The script:

DayForm = Request.Form("D1")

Dim hoje
Dim dia

If DayForm = "" OR DayForm = 0 Then hoje = true

If hoje Then _
Set rs = conn.Execute("SELECT

convert(varchar,PDE#HD#Consumption#RP_Consumption_Gas.T,108),(PDE#HD#Consumption
#RP_Consumption_Gas.V/PDE#HD#SpeedCurves#Productivity.V) As Consumo FROM

PDE#HD#Consumption#RP_Consumption_Gas INNER JOIN PDE#HD#SpeedCurves#Productivity ON

PDE#HD#Consumption#RP_Consumption_Gas.T = PDE#HD#SpeedCurves#Productivity.T WHERE

PDE#HD#Consumption#RP_Consumption_Gas.T > DATEADD(dd, -1, GetDate()) ORDER BY

PDE#HD#Consumption#RP_Consumption_Gas.T") _
Else _
Set rs = conn.Execute("SELECT

convert(varchar,PDE#HD#Consumption#RP_Consumption_Gas.T,108),(PDE#HD#Consumption
#RP_Consumption_Gas.V/PDE#HD#SpeedCurves#Productivity.V) As Consumo FROM

PDE#HD#Consumption#RP_Consumption_Gas INNER JOIN PDE#HD#SpeedCurves#Productivity ON

PDE#HD#Consumption#RP_Consumption_Gas.T = PDE#HD#SpeedCurves#Productivity.T WHERE

PDE#HD#Consumption#RP_Consumption_Gas.T > convert(date, DATEADD(dd, " & DayForm & ", GetDate())) AND

PDE#HD#Consumption#RP_Consumption_Gas.T < convert(date, DATEADD(dd, " & DayForm+1 & ", GetDate())) ORDER BY

PDE#HD#Consumption#RP_Consumption_Gas.T ")

View 2 Replies View Related

View Of Max Values From Many Tables

May 22, 2007

I have about 14 tables that I am trying to tie together in a view tosee a user's status in our company.Joe User:Email - ActiveADP - ActivePortal - Inactiveetc.We need to track application access across the company, so we havetables for each application that contain user info(username,password(encrypted), start date, end date, changed date) so that wecan track who has what, and when they were given access as well aswhen it was taken away.Every application table has a userID attached to it.What I would like to do is to take the userID field and look for theirapplication access across the company. To do this, i'll have to lookfor the max value in each table because someone could be given access,have it taken away, and be given it again. People move all over theplace here, so we have to be able to track who has what, when, and atwhat building.I started out with trying to left outer join the tables together, butit didn't work. I tried doing something along the lines of:selectesarfAppEmail.emailID,esarfAppEmail.esarfUserID,CASE WHEN esarfAppEmail.endDate IS NULL Then 'Active' else 'Inactive'end as EmailStatus--,


Quote:

View 2 Replies View Related

Unique Values Between Two Tables.

Jul 20, 2005

Hi,I have two tables such that in each table I need to make sure thatcolumn x in table A and column y in table B have a unique valuesmeaning that a user cannot insert a value to column A if its alreadyexist in column B and vice versa.How can I enforce it? Please remember that this two different tables.Thanks,Ori.

View 2 Replies View Related

Inserting Values Into Multiple Tables

Jan 25, 2008

Hi All,     am new to sql server in my application I am having one Asp.net web page, the user has to enter values for 5 fields(Empno,Empname,salary,deptno,deptname) in that web page and for that i created two tables in sql serverEmp Table- empno(primary key),empname,salaryDept Table- Deptno(primary key),empno(Foreign key ),Deptname(with some check constraint.) After the user enter all the values in the Asp.net web page now i want to store data into database for that i wrote the following stored procedure...create procedure usp_EmpDept  @empno integer,  @empname varchar(15),  @salary money,  @deptno integer,  @deptname varchar(10)  As    Insert into emp(empno,empname,salary)values(@empno,@empname,@salary)  Insert into dept(deptno,Empno,deptname)values(@deptno,@empno,@deptname)   but the problem is whenever some constaint violation for eg. if some check constraint violation in Dept table its inserting the values in the Emp table only, but my requirement is,  It must enter into both tables if there is no constaraint violation otherwise it has to ignore both the tables.  And also please suggest is there any better way to insert values into two tables other than using the stored procedure Any help will be greatly appreciated..Thanks,Vision..   

View 6 Replies View Related

Checking Duplicate Values Two Tables

Feb 5, 2005

Hi All,

Is it possible in SQL to Restrict value in one table checking a value on anather tables.

Scenerio-1.

I have two table let say,
Teb1 and Teb2. Teb1 has a column called- Business_type and Teb2 has a coulmn called Incorporated_date. I just need to restrict If the value of Business_type column in Teb1 is "Propritory" then Incorporated_date in Teb2 should not be blank (nulll) . Otherwise it can take null value.

Scenerio -2.[/B]

I have table called [B]SIC.

This table has a two column called SIC1 anc SIC2 . Is it possible to restrict that clumn SIC1 and SIC2 should have same values( duplicate values cannot be entered in both columns.

Please Advise.
Vijay

View 1 Replies View Related

Join Two Tables And Update Values In One

Feb 21, 2012

I have two tables A and b

A
projectID Setid value
301 1 abc
301 2 xyz
302 4 def
..... .... ..

B
SettingsId Setvalue
1 ter
2 yet
4 44
... ....

I want to update all the Setid of table A with that of values from table b. How can i do this?

View 7 Replies View Related

Compare Data Values Of 2 Tables

Dec 4, 2014

I have 2 databases( "A" + "B") with identical number of tables and identical number of records for each table. There are also identical number of fields pre record per table. Table A has had the sensitive data within the fields scrambled.

I need to know if there is a way to read down each DB table by table, record by record, field by field and compare the data values. If they are different I need to output the Field name, the data value and the Table name from the Scrambled Table (lets say its "A").

View 1 Replies View Related

Join Tables On Sorted Values

Nov 19, 2013

Is there a way to join tables that have multiple matches to each other (2 records in one table and 2 in another) so that you get 2 records returned instead of 4 with only 1 JOIN ON qualifier?

In our warehouse DB, there is a master location table, an inventory location table, and physical table for counting all product in the warehouse. The master location table has one record per location, but there could be multiple items in that location so my outer join from the master location to the inventory table returns something like:

select M.MASTER_LOC, C.AS ORIG_ITEM, C.ORIG_LOT, C.ORIG_QTY
from
M_LOC M LEFT OUTER JOIN
C_INVT C ON M.MASTER_LOC = C.INVT_LOC
order by M.LOC_CODE

LOCATION ITEM LOT QTY
01-01-A 100 abc 25
01-02-A NULL NULL NULL
01-03-A 200 def 50
01-03-A 200 ghi 50

My problem is adding the third counted inventory table because it could look like anything depending on what we find in the racks:

LOCATION ITEM LOT QTY
01-01-A 100 abc 25 (exact match)
01-02-A 150 cba 75 (Item found)
01-03-A 200 ghi 50 (LOT swapped)
01-03-A 300 def 50 (Item Changed)

My join is returning 4 rows for location 01-03-A which I understand, but I'm wondering if I can sort within the join or make some temp tables so that instead of:

select M.MASTER_LOC, C.AS ORIG_ITEM, C.ORIG_LOT, C.ORIG_QTY, E.AS CNTD_ITEM, E.CNTD_LOT, E.CNTD_QTY
from
M_LOC M LEFT OUTER JOIN
C_INVT C ON M.MASTER_LOC = C.INVT_LOC LEFT OUTER JOIN
E_PHYS_INVT E ON M.MASTER_LOC = E.LOC_CODE
order by M.LOC_CODE

LOC1 ITEM LOT QTY LOC2 ITEM LOT QTY
01-03-A 200 def 50 01-03-A 200 ghi 50
01-03-A 200 def 5001-03-A 300 def 50
01-03-A 200 ghi 5001-03-A 200 ghi 50
01-03-A 200 ghi 5001-03-A 300 def 50

I'd like to just end up with 2 lines sorted by location, item, lot, qty so I can see that there is a problem with that location.

LOC1 ITEM LOT QTY LOC2 ITEM LOT QTY
01-03-A 200 def 5001-03-A 200 ghi 50
01-03-A 200 ghi 5001-03-A 300 def 50

View 2 Replies View Related

Insert With Max Values From Multiple Tables

Dec 20, 2007

I am trying to add records to 2 separate tables and each table has a unique ID from the other table. I need to find the highest number ID from both tables (and add 1) and add a record with both new values to both tables.

I have tried the following, but it is not working. Any help would be appreciated, Thanks (my tables are MEMOS and PDSMSGC)


INSERT INTO MEMOS (MemoID, ParentID, FieldName, MemoText)
SELECT MAX(MemoID) + 1 FROM "MEMOS", MAX(MessageID) +1 FROM "PDSMSGC", 'pmc:MemoID', 'Hi my name is bob'
INSERT INTO PDSMSGC (MessageID, MemoID) SELECT MAX(MessageID) + 1 FROM "PDSMSGC", MAX(MemoID) FROM "MEMOS"

View 5 Replies View Related

Transact SQL :: Sum Values By Grouping Name From Two Tables

Nov 6, 2015

I have two tbles that have ItemName and their bill amount

a) tblLunch

which shows records like below

Invoice   Item                          Amount  
--------------------------------------------
1             COFFEE                       1000.00 
2             TEA                          2000.00
3             ICE CREAM                1000.00

b) tblDinner

which shows records like below

Invoice   Item                      Amount  
------------------------------------------------------------
1             COFFEE                  1000.00 
2             TEA                        2000.00
3             PASTA         1000.00

I want to perform a query that should SUM Amount Columns by Grouping the Item from both the tables, so we could get the following result

Item                      Amount  
------------------------------
COFFEE                  2000.00 
TEA                        4000.00
ICE CREAM           1000.00
PASTA                    1000.00

View 3 Replies View Related

Replicate Tables With Default Values

Aug 20, 2007

Hi,
I am trying to replicate some of my production tables into development tables in an automated way. Decided to use the Select INTO command because it seemed to be the easiest way. This command does copy all the col sizes, but does not copy over the "default value or binding" fields. How do I do this? I saw that in create table you can use "INCLUDING COLUMN DEFAULTS "

But this doesn't seem to work for the select into command. Can you tell me how I can do this? Currently the command I am using is:


SELECT * INTO " + DevTableName + " From " + ProdTableName


However, this won't copy over the default column values that I have specified inside the table ProdTableName. Can you tell me how I can do this?

Thanks,
-Ankur

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved