Change One Data To Another
Oct 18, 2007
Maybe a strange query here for you guys but I would like to create a database where a user enters a code then they are transferred to another code - some explanantion:
SCD = Sony CD - expensive stuff
PCD = Phillips CD - expensive stuff
CCD = Cheap CD - cheaper stuff
User enters SCD then automatically the database would change SCD to CCD but it can also be that the user enters PCD and the database would change PCD to CCD. So when looking at the results for this table i would have 2 entries for CCD and also another 2 to say the user entered SCD and PCD. - hopefully that makes sense.
I need to know and understand how i should design the database to accomplish this so i can avoid any "gotcha" mistakes. Any thoughts on this?
Thanks
View 4 Replies
ADVERTISEMENT
Aug 12, 2015
I have a requirement to implement CDC for 50+ tables to implement incremental data changes warehouse/reporting rather than exporting the whole table data. The largest table is having more than half a billion records.
The warehouse use a daily copy of OLTP db (daily DB refresh). How can I accomplish this. Is there a downside in implementing CDC just for the sake of taking incremental changes on the tables?
Is there any performance impact if we enable CDC on OLTP db?
Can we make use of the CDC tables on the environment we do daily db refresh so that the queries don't hit OLTP database?
What is the best way to implement CDC to take incremental changes for reporting.
View 0 Replies
View Related
Aug 6, 2015
I want to make data changes in read_only database , that's why i must set database read_write. While database is at read_write mode, i want to be sure that no one makes change in database.
For this aim, i write the code below, but i suspect that after setting the database read_write, till the setting database
single_user ,is it possible get DML script from another user. Is the code below enough for this operation. Or is there another way?
Reminding: Read_only database can not be set single_user mode. That's why, first you must set database read_write.
The code;
use master
alter database xxx set read_write
with rollback immediate
alter database xxx set single_user
with rollback immediate
use xxx
update tablexxx set columnxxx=yyy
use master
alter database xxx set read_only
with rollback immediate
alter database xxx set multi_user
with rollback immediate
View 5 Replies
View Related
Apr 21, 2014
I am using SQL Server 2012 and to me a part of data captured by CDC is not making sense.
I have a table called 'Schema.Table1', and I enabled CDC on it by running 'sys.sp_cdc_enable_table'. I see that a table called 'cdc.Schema_Table1_CT' got created which now gets an entry when ever I Insert, Update or delete a record in the original table.
Till this point every thing works fine.
My original Table has a NOT NULL INT column called 'AuditTrackerUserID' with a default value of 1996. My application does not provides a value for this column, but because the column itself has a default value, records get inserted without error.
When I try to execute the following Query I see multiple records with __$operation of 3 and 1.
SELECT * from cdc.Schema_Table1_CT where AuditTrackerUserID IS NULL
My expectation is that I should not ever see any record returned by this query because AuditTrackerUserID is a not null column, but I do.
View 2 Replies
View Related
Apr 4, 2007
i someone had teach me how to write a query in datatable. however i need to get the data out from my database rather than the data table. can someone teach me how should i do it?esp at the first like.... like DataTable dt = GetFilledTable() since i already have set of data in my preset table i should be getting data from SqlDataSource1 right ( however i am writing this in my background code or within <script></script> so can anyone help me? protected void lnkRadius_Click(object sender, EventArgs e) { DataTable dt = GetFilledTable(); double radius = Convert.ToDouble(txtRadius.Text); decimal checkX = (decimal)dt.Rows[0]["Latitude"]; decimal checkY = (decimal)dt.Rows[0]["Longitude"]; // expect dt[0] to pass - as this is our check point // We use for rather than fopreach because the later does not allow DELETE during loop execution for(int index=0; index < dt.Rows.Count; index++) { DataRow dr = dt.Rows[index]; decimal testX = (decimal)dr["Latitude"]; decimal testY = (decimal)dr["Longitude"]; double testXzeroed = Convert.ToDouble(testX -= checkX); double testYzeroed = Convert.ToDouble(testY -= checkY); double distance = Math.Sqrt((testXzeroed * testXzeroed) + (testYzeroed * testYzeroed)); // mark for delete (not allowed in a foreach - so we use "for") if (distance > radius) dr.Delete(); } // accept deletes dt.AcceptChanges(); GridView1.DataSource = dt.DefaultView; GridView1.DataBind(); }
View 2 Replies
View Related
Dec 13, 2004
Can anybody suggest the best way I can achieve the following.
To select anybody whose surname has change in the last week, and to automatically flag a code field with "C". :cool:
View 5 Replies
View Related
Jun 23, 2005
I'm trying to compare 2 field in 2 different databases and one is varchar and one is numeric. Is there anyway I can tell SQL to treat the one thats numeric as varchar or convert numeric to varchar for the comparison string... I'm trying to run the following in query anaylzer:update crcwebauth.dbo.deviationmaster set ldate = (select max(qvdate) from crcbrio.dbo.invoice_tbl where dnumber = qvqote)It gives me error:Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to numeric.The DNumber field is numeric and the qvqote is a char field...
View 1 Replies
View Related
Apr 20, 2001
Hi,
I am not sure how to change data and log file name on existing database,
If it is oracle, I just need mount database and use alter database statement
to change data file name or location.
How to do it in SQL7??
Thanks
View 1 Replies
View Related
Jun 3, 2004
Hi All,
Is anyone can help me to change a existing data file into a new new name?
Thanks.
View 4 Replies
View Related
Feb 13, 2012
I am trying to create a group on this data example
RecordNo, Item, Date,NULL
1, ABBB, NULL, 0 << first group
2, ABBB, 01-06-2011,NULL << first group
3, ABBB,NULL,NULL << 2nd group
4, ABBB, 02-01-2011,NULL << 2nd group
5,CAAA,NULL,NULL << 1st group
6,CAAA,NULL,NULL << 1st group
7,CAAA,01-01-2010,NULL << 1st group
8,CAAA,01-01-2011,NULL << 2nd group
9,CAAA,01-05-2012, NULL << 3rd group
Basically 3 groups on date, by item, so for each date change/ per part the group increments been playing with row_number partitions, but cant seem to get what i need.
View 14 Replies
View Related
Nov 14, 2014
I have a database (MSSQL). To demonstrate the problem let me show a fictive Tablestructure. I don't want to discuss about how to save the data differntly, because the structure is fix and I can't change it.To get this result I would do a sql query with a lot of joins like that:
SELECT firstname, lastname, email.value, phone.value
FROM Customer
INNER JOIN
(
SELECT Customer_Properties.id, Customer_Properties.value
FROM Customer_Properties
[code]...
I don't think that this is really performant and the SQL-Queries get very complicated. Give it a other methode for that? I can't change the data structure.
View 3 Replies
View Related
Sep 28, 2005
I have a db; that stores a company name; if the end user types in
The Stoneware Jar Company
I would like to display:
Stoneware Jar Company
All company names entered like that with no preceding "The"
How can I display something diff on my ASP Page? Possible?
View 20 Replies
View Related
Oct 6, 2005
I received a db2 data file that I converted to MS-Access. From Access Iran the upsize wizard to put the tabel in SQL. It put the table in okbut all the data types are nvarchar. I have a couple of the fields thatare cureny and some that are numeric.I need to change the data types from nvarchar to numeric type fields. Iam new to SQL so I do not know all the commands. How do I change thedata type?Michael Charney*** Sent via Developersdex http://www.developersdex.com ***
View 1 Replies
View Related
Apr 17, 2008
I have a database with a table of 1,123 records that I need to change in a
hurry! The problem is I do not know how to do it.... For example there are 2
fields that are numerical and formatted buy currency 1 record reads 400 and
the other reads 400, but I need to double the amount for both fields and all
of the records. Please help..... Thanx in advance for any and all help..
View 7 Replies
View Related
Dec 14, 2006
If I were to change a data source that many packages use (say, from box "SQL-2" to "SQL-1"), would I have to re-upload the packages that used that data source? Or would the packages already on the server receive that change somehow?
(currently realizing that most of the packages use package-local data connections instead of project-wide data sources...)
Thanks!
-Rob
View 1 Replies
View Related
Jan 13, 2006
Again, looking for the best way to do this with SSIS.
I have a source table and I'd like to load it to a database daily, capturing what changed.
This is not a dimentional table but a fact table.
So, what I;d need to do for each record is to see if the record already exists (using business key) and if it does - compare some of the data fields and of there are changes - register it somehow and if not changes ignore.
Right now, the only two ways I see to do it with SSIS:
- Use Slowly Chaging Dimentions transformation
- Use Lookup and customize SQL, adding something like: WHERE key = ? and (field1 <> ? or field2 <> ?...)
I was wondering of there an easy way.
Dima.
View 3 Replies
View Related
Oct 28, 2007
hi
I have a table like this
Username
Clicks
Impressions
Download
User1
12
23
43
User2
34
33
59
User3
39
88
77
User4
34
43
43
need to change the table like this
User1
User2
User3
User4
clicks
12
42
43
43
Impressions
43
43
43
43
download
43
43
43
43
Thanks
Ezhil
View 4 Replies
View Related
Aug 20, 2007
How do I programatically change a column (say username) in a table (say tblusers) from varchar(25) to varchar(100)I am looking for something likealter tblusers set username as varchar(100) I know the above statement in nonsensical but it conveys the idea.
View 3 Replies
View Related
Nov 24, 2000
Hello
i have a package who export data in a text file,
this package is schedule all the night
how i can change the name of the file dynamically ?
or how the new data can be append at the end of the file ?
Thanks
Cyril Caillaud
View 1 Replies
View Related
Sep 17, 2005
I would like to change column data in all tables in a single database at once.
For instance, i have many tables in a database, and about 30% of the tables has the column "orderplace".
And all the data in orderplace (every tables in the database) are "houston". instead of going to each table and
"update table set orderplace = 'dallas' " .... is there anyway that i could run a sql statement and it will update all the tables in database that has the orderplace column to "orderplace = 'dallas' " ?
any ideas ? thanks.
View 5 Replies
View Related
Jul 28, 2015
When using Change Data Capture on SQL Server 2012 I have researched that you cannot truncate data in a table. Is this also true if one wanted to delete data from the table? Getting a little confused about what DDL statements can be ran against a table with CDC enabled. Does CDC have to be disabled before performing certain DDL statements against a table?
I would like to safeguard the truncation and dropping of certain tables within the dbo schema. Wondering if I could do this with one fail swoop with CDC enabled on those tables. The other option would be to use a DDL trigger to prevent certain DDL statements to be performed.
View 2 Replies
View Related
Feb 24, 2014
How to modify/change data that is in a SQL table column. Here is what I need or have
I have 2 tables, Table 1 and Table 2, within those 2 tables there is 1 Column that has the same column heading aswell as data within,(I will call it the serial_number column) there is also a 2nd column that is labeled the Same in both tables, I would like to be able to update the Values in the 2nd column of table 1 with the values from table 2 column 3, using the Serial_number column as my matching reference between the 2, the data is not in the same order between the 2 Tables,
More or less I need to set the value of table 1/column 2 to match table 2/column 3, where the serial_numbers are the same in both tables serial_number columns, the data being changed is set as Small int...
View 3 Replies
View Related
Jul 11, 2007
I have an issue where i have a field that changes data and i need to trace what it is that is changing it. I have setup a trace for the database but i would like to be able to narrow it down even further to the table and even the column if possible. Is there a way that i can trace data changes on such a granular level
View 1 Replies
View Related
Oct 2, 2007
Hi there
Assuming this is the query used to return this result:
select dept.name, count(prj.id) from department dept, project prj where prj.id = dept.uid group by dept.name
Dept, TotalProj
A , 10
B , 5
C , 2
Question: How do I change the query so that the result will return as follows:
Dept/TotalProj
A, B, C
10, 5, 2
View 5 Replies
View Related
Jul 23, 2005
I'm doing a data conversion project, moving data from one SQL app toanother.I'm using INSERT INTO with Select and have the syntax correct. But whenexecuting the script I get:Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to float.Is it possible to change the data type during the INSERT INTO statement?Thanks
View 3 Replies
View Related
Jan 11, 2006
I'm planning to establish a recovery plan for my SQLServer 2000databases. How to change home and data directories?
View 3 Replies
View Related
Jul 20, 2005
I've created a SQL View in SQL 2000 using a table that has columnsdefined as Numeric data type. In the view, I am grouping and summing.When I link the view via ODBC to Access, all of the data types arechanged to text. If I link the original table which the views arecreated from to Access, the data types are correct. So this problemobviously happens when I change the view to Group. Is there a wayaround this? I want the data types to be correct in Access when Ilink to the views.thanks,jim
View 1 Replies
View Related
May 18, 2006
Hi,
I would like to know is there any way we can assign/change the value of variable within data flow without using script component?
Thx.
View 7 Replies
View Related
Oct 3, 2007
Is there anyway to change the data type of a variable while in an expression?
My problem is I am trying to compare a variable w/ a string data type to a variable w/ an object data type. I would change the data type of the variable from object to string but if I do that my sql task fails when it tries to write a value to that variable. The variable w/ the object data type is the result of an openquery sql stmnt. So I guess there are two ways around my problem.
1. Change data type of variable while in an expression..ie flow constriant
or
2. Change data type of vraiable from object to string and still get the openquery result to work.
Any help???
Thanks !!
View 4 Replies
View Related
Oct 17, 2007
Is there a built in functionality to do the CDS in SSIS 2005? if not, what is the best way to do this in ssis 2005?
View 2 Replies
View Related
May 14, 2008
Hi.
I have tables (they are empty and there are no constraints) with columns typed as varchar. In a database I want to change the type of all the varchar columns in all the tables from varchar to nvarchar. What's the best way to do it? Can you suggest code?
I know that to get all the relevant columns I would issue a query like this
select *
from information_schema.columns
where data_type = 'varchar'
Then I would use a cursor... And that's exactly what I would not like to do. Is there any other way?
Thanx.
Darek
View 3 Replies
View Related
Sep 4, 2007
i'm hoping someone can help me out with this problem.
i have a database called Tracking.mdf and its associated logfile Tracking_log.ldf
i need to build another database based on the above with more tables and keep the data separate hence the requirement to make a copy of the tracking data file i've tried changing its name but it will not attach. i can change its database name to whatever i want but somehow can't find out how i can say change its actual filename to Tracker.mdf and Tracker_log.ldf
would someone be able to help me out. thanks.
View 1 Replies
View Related
Oct 1, 2007
Hi,
here is my problem
i've a table in my database like this
Col1 | Col 2
____|______
aaa | 111
aaa | 222
aaa | 333
bbb | 222
bbb | 333
to insert data into a flat text file or another table
i would like to make a dataset like that :
Col1| Col2| Col3 | Col4
____|____|_____|_____
aaa | 111 | 222 | 333
bbb | 222 | 333 | NULL
the table is quite big, so i can't make it line by line
i would like to have a maximum of 12 column ( if there is more data than 12, these data should be ignored )
thanks for answering
View 3 Replies
View Related