Changing Data In SQL
Jul 20, 2005
First of all I am not familiar with SQL so bear with me.
I have a field called stock_code, the data in that field, looks like
this
000000851. I need to replace only the first two charachters '00' with
'DR'.
If I use the replace function, it will of course replace every
occurance of 00 which I dont want.
Apart from exporting the data out to excel and changing it there
Thanks
Alan
View 3 Replies
ADVERTISEMENT
Feb 28, 2008
Hi, all experts here,
Do we always have to use SCD component for the loading of data into data warehouse to handle changes of rows?
I am looking forward to hearing from you and thank you very much in advance for your help.
With best regards,
View 4 Replies
View Related
Apr 16, 2014
I have an source file and i have to load it into the data base by changing datatype of the columns in ssis
View 1 Replies
View Related
Oct 3, 2007
I have a fairly simple data flow task that loads data from one table (OLE DB Source) into another table (OLE DB Destination). The data type for one of the pairs of columns is nVarChar(120) and it contains version information that looks like a decimal. When I run the export, the destination has a trailing zero added after the decimal point as if it were a numeric column which invalidates our comparisons (string 1.0 is not the same as string 1.00). There is no cast or convert done to this column, it is a straight copy. Any ideas what could be causing this or how to fix?
View 6 Replies
View Related
Aug 29, 2006
I have created a SSIS package that transfer data from a Foxpro database to an instance of SQL Server 2005 Express. I used the wizard to create the package but I load and execute the package within a custom application that I have written in C#.
The way the custom application is intended to work is that the user can have the database in any location on the computer and all he has to do is specify the location then the application programatically changes the location of the source on the package that it has loaded and then execute it. When I initially run the package the first time (using the original path), it works fine and transfers the data. However, every subsequent time I run the application and specify a different path, the database on the SQL Server side gets created as expected but the data is not transfered!
Where am I going wrong? Do I need to save the package after I modify the source then reload and run it again or do i need to change something else in the Data Flow to make this work?
View 4 Replies
View Related
Oct 17, 2002
Please HELP!
I need to UPDATE a column by removing only the first occurance of $$sp;. I use the following to get an idea of what I have:
SELECT Reporting_Title_Html FROM Lab_Test Where RTRIM(Reporting_Title_Html)='$$sp;'
Reporting_Title_Html
------------------------------
$$sp;
$$sp;
$$sp;
$$sp;
$$sp;Thyroid maintenance required;$$sp..........
Get 5 Records....One record has multiple occurances of $$sp throughout the Reporting_Title_Html column.
I thought I could do:
Update Lab_Test Set Reporting_Title_Html=' ' Where RTRIM(Reporting_Title_Html)='$$sp;'
But I can't lose the trailing data from record #5. This is just a small sampling of what I'm trying to fix.
Any Ideas???
I've thought about REPLACE but that would replace all the $$sp's and I only want to change the very first one from $$sp to ' ' --> blank
View 1 Replies
View Related
Dec 27, 2006
How do I go from a text data type to a numeric data type without having to delete the column and put it back out there. I tried to changed the data type but it gave me a error saying that I couldn't go from text to int data type. Help.
View 4 Replies
View Related
Sep 4, 2007
Hi All,I have a varchar(255) column for storing text in english and inhebrew.It was a stupid mistake to set the data type to be varchar, becausenow I need to store text in german and francais too.Question: Is it safe to change the data type from varchar to nvarchar,without damaging the data that's already present?(I have more than 1000000 records stored...)Thanks,Danny
View 4 Replies
View Related
Nov 13, 2007
Hello,
I'm working on a distributed application which requires data from a central database to be shown to various users. In particular users should be able to open "views" on the database, specifying the data they are interested in, and being shown the result.
This can be easily accomplished modeling the view specifications as SQL select queries, sending those queries to the server, and visualizing the result. This approach is very flexible, supported, fast and definitely the way we would like to implement it.
The problem is that we have an additional requirement.
In general the data the users might be interested in is not static, and when that data changes, those changes should be propagated to the client views.
There are lots of solutions and technologies aimed to solve very similar problems, but no one seems to support this scenario well.
1. You can re-run the queries every x time (polling)... but this is hardly an option when you have hundreds of client-views that require data to be updated in real-time (so "x time" should be, say, 1 second).
2. You can use query notification... but the documentation explicitily says it doesn't scale well and shouldn't be used with a large number of clients (which is exactly what is needed in this case).
3. You can use replication services... but this technology doesn't really seem to be created to support this scenario.
4. You can use notification services... but even this technology seems to be focused on different scenarios. I haven't looked at it extensively anyway.
5. You can use DML triggers to track data changes... but you still don't have the publish-subscribe mechanism to register client views and the mechanism to know which client views are affected by the changes.
6. You can implement a business logic tier that relates modification requests to client views... and basically do everything from scratch without using existing services.
What are your opinions?
Thank you,
Lorenzo Castelli
View 2 Replies
View Related
May 21, 2006
Use databases a bit, but new to SQL Server. We just want to change a column of existing SQL Server 2005 data from a string data type to one of the UNiCODE data types, such as DT_WSTR or DT.NTEXT (such as one can use for various data mining tasks, etc.). It seems to do this one needs to "the data conversion transformation editor". To use that one has to have a package and a project?
Does any one have a full script or set of steps to do the full set of steps for what should be a simple task? This would be a great example for BOL, but each atomistic bit of BOL refers to another, and one gets lost in the circle when a complete example is needed for fundamantal housekeeping tasks.
View 6 Replies
View Related
Sep 23, 2015
If I have an ACID-based SQL engine and I run a long-running transaction that changes a record at some point during the transaction, and at the same time it's running another transaction changes a record that the long running transaction has/will change/d, will they both complete or will one transaction fail? If they both complete who wins the final state of the record? The long running one or the other one? (is it based on when the transaction actually started "point in time" or is it specific to when the record was changed during the transaction "point in time"?)
View 5 Replies
View Related
Nov 23, 2007
I want to change a column's data type from bit to int. There are data in the table already. I'm wondering if it is save/correct way to issue the following command to change the data type for that column.ALTER TABLE database_tableALTER COLUMN my_bit_column INT; Thanks.
View 1 Replies
View Related
Mar 24, 2008
Hello all,
I am trying to modify the output of a SELECT statement in a VB asp.net page that pulls data from a SQL DB. I only need to modify one column in the gridview, but I'm having some issues.
Here is the situation:SELECT TOP 24 ID, RecID, Timestamp, Answered, Holds, Dropped, Waits, Voicemail, Busied, LiveWaitsFROM mTrafficORDER BY Timestamp DESC
The Timestamp column returns a number value (i.e. 564566).In terms of a date, 564566 doesn't mean anything to the user, so I need to convert this number into a recognizable and accurate date.
The formula I need to implement is Timestamp/1440 - 1
The following SELECT statement returns the number as a date, but makes all records the same date:
SELECT TOP 24 ID, RecID, Convert(datetime, Timestamp/1440 + 1) as Timestamp, Answered, Holds, Dropped, Waits, Voicemail, Busied, LiveWaitsFROM mTrafficORDER BY Timestamp DESC
What do I need to do to implement this function dynamically into my gridview?
Thanks in advance!
Chris
View 2 Replies
View Related
Dec 4, 2004
We have a SQL Server setup as a publisher to 15 subscribers. We need to change the path of the data & log files to a new drive (added a new harddisk). We plan to take a cold backup of the database and shift the data & log files to the new drive. Then we just attach the data & log files from the new path.
Will this disturb my existing replication Setup?
Is the the correct procedure for changing the path of the existing data & log files?
What is the appropriate method for shifting data & log file of a live database to a different location (directory/drive) ?
thanks in advance
View 2 Replies
View Related
Feb 20, 2004
I have a table that looks like this:
ID Type
123 Phone
123 Meeting
123 Phone
and I would like the data to look like this
ID phone Meeting
123 2 1
How do I do this?
View 3 Replies
View Related
Apr 27, 2008
I've got a customer who wants reproducible/historical reporting. The problem is that the underlying data changes.
I tried to explain that this can't be done (can it?), but he doesn't
understand.
To illustrate the situation - Let's say a teacher wants to track
spelling test scores for her students.
The below are scores for students A, B, and C (for January, February, March)
A: {70,80,85}
B: {70,65, 80}
C: {100,90,100}
So, I can generate a historical report that charts the class average
and student trend - that's pretty easy.
Now, in April, we find that the school board has mandated that the
British spelling of words is ok, so now the cumulative scores (for
January, February, March, April)
A: {90,80,85,100}
B: {80,65, 80,80}
C: {100,90,100,75}
He wants a report showing the January average as (70+70+100)/3 = 80,
when really it is (90+80+100)/3 = 90.
Now imagine that there are actually thousands of data points changing like this...
Now also imagine that we add and remove students on a regular basis...
He and his office manager get frustrated when I explain that the
reports are not simple - in their mind it is. They have determined
the solution is to get a report writer and buy Crystal Reports...
I've tried to explain that the problem is that the report
specification is unclear (basically - they don't understand what they want). The situation is ok for now, I'm just trying to plan for when they figure out that buying Crystal Reports won't change their situation (except they are done several thousand dollars)...
Any tips?
View 20 Replies
View Related
May 21, 2008
I moved a database from one server to another, in this database are references to a UNC path on the server. now I need to find a way to modify the server name that was in each row to reflect the new server name and path, ex:
\server1path1data to now say
\server2path2data
how do I selectivly modify just some of the data? or do I have to basically re-write the entire column for each row?
View 1 Replies
View Related
Feb 26, 2007
Hi,
I was wondering how to modify a column's properties, like its datatype or length.
I know I'm supposed to do something like this:
ALTER TABLE MyTable ALTER COLUMN MyColumn int(20)
My main concern is, what will the database do to all the data in the column, if the column used to be, say nvarchar(50)? Will I lose the data in the column if I change the datatype? And what if I had data in this column that was longer than 20 characters? Will the data now be truncated? What can I do to make sure that nothing happens to the data once I change the datatype?
Any help would be greatly appreciated! Thanks! =)
View 5 Replies
View Related
Mar 20, 2007
i changed a float data type to a decimal and have lost accurate details, is there a way of rolling back to what it was before
View 1 Replies
View Related
Jul 20, 2005
Hey all,I have a basic table that looks something like this.CREATE TABLE MyTable(ID INT IDENTITY PRIMARY KEY,Company_ID INT NOT NULL,Round VARCHAR(50) NOT NULL,Details VARCHAR(250) NOT NULL)It has a few rows of data that look like this:Identity Company_ID Round Details--------------------------------------------1 5 A Blah, blah.2 5 B Generic data, blah blah.3 5 WERT More generic blah blah.Now what i'm trying to do during my select statement is select all the rowsthat belong to company_id 5 but if any of the rows round value contains thetext "WERT" convert that text into just a "--" for presentation purposes,but still select that row. I can't seem to figure out how i would transformthe text in the select statement? My immediate thought was substring /replace but i would need to combine it with an if else statement which i'veno idea how to make work in a select (sub-query maybe?) statement. Is thispossible? Perhaps i'm stuck iterating through the returned data within theclient application before presenting?Any help, as always, would be greatly appreciated.Muhd
View 5 Replies
View Related
Apr 21, 2006
I have stock data in 1 min intervals and would like to convert it into other timeframes (e.g., 10 min, daily, monthly).
Here's is some sample data and my final goal:
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.87 3.87 10
10-Feb-05 12:11:00 3.87 3.87 3.87 3.87 2
10-Feb-05 12:12:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:13:00 3.85 3.87 3.84 3.85 23
10-Feb-05 12:14:00 3.85 3.85 3.85 3.85 6
10-Feb-05 12:15:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:16:00 3.85 3.85 3.85 3.85 1
10-Feb-05 12:18:00 3.85 3.85 3.85 3.85 3
10-Feb-05 12:19:00 3.85 3.85 3.85 3.85 3
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.84 3.85 50 *
*sum
View 8 Replies
View Related
Apr 4, 2007
How do i change data type settings in when building my tables?
Specifically i want to reduce the number of decimal places on 'smallmoney' so it doesn't show 4 but rather 2. Thank you.
View 2 Replies
View Related
Sep 4, 2007
Can I change databases for a SqlDataSource in code behind and still use the edit,inset,delete capabilities of the SQLDataSource control?
View 1 Replies
View Related
Aug 24, 2000
Is there a way to change the physical mapping of a user defined data type to the physical SQL Server datatype. It seems that once you create them, it is just about impossible to change it.
Thanks,
Andrew Abrams
View 3 Replies
View Related
May 26, 2004
Hi,
I have a sql server 7 running on a machine with two disk partitions (D: and E:).
The data files xxx.mdf and xxx.ldf are stored in D:, which has very few space available. I want to copy these files to E: but I get an error saying that it is not possible to change the source file of a database. Is it possible to do it or do i have to create another data file in E: and keep the old one in D:?
Thanks in advance,
browser
View 3 Replies
View Related
Mar 28, 2006
I have tables that I want to fire either an update or insert trigger on.I could write a script containing a long list of inserts but I'm looking forsomething simpler. Would isql work? Any special conditions to get it towork?I've tried tricks like 'update x set col = col' or 'update x set col = col +'' 'All the alternatives seem to have problems. Any ideas?----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups----= East and West-Coast Server Farms - Total Privacy via Encryption =----
View 5 Replies
View Related
Mar 2, 2007
Thanks in adance
Platform: SQL 2000
A SQL table has a field named "pay-day" with Char(8) data type.
I tried to change its data type to datetime but only with an error message like this. I did right-click the table and tried to modify a data type.
- Unable to modify table.
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.
Jay
View 4 Replies
View Related
May 18, 2006
Greetings once again SQL friends,
Sorry to bug you with my silly questions but this little problem has been driving me crazy for the last hour or so!
I am attempting to change the data type of a variable in an expression but I keep getting an error saying that the expression can not be evaluated.
The syntax I am using is as follows :
(dt_str) @[User::MAX_OFFER_PRICE_ID]
My variable MAX_OFFER_PRICE_ID is type int32 and I am attempting to cast it as a string.
What am I doing wrong?!
Thanks for your help in advance.
View 7 Replies
View Related
Dec 25, 2006
Hi Guys,
We had existing cubes in our Analysis Server, we were required to move them on another Reporting Server which would be using Data Replicated every night to that server. Problem is now source data is divided into 2 Reporting Database Servers. Table Names/View Names are the same in all the Databases. I just want to change the data source pointing to existing Database to the new Reporting Server. Can you tell me how this can be achieved?
Regards,
Kaushal
View 3 Replies
View Related
Sep 20, 2006
hi..
How do i prevent other users from changing the data of my tables? Means one can change data using only my login rest others cannot even DBA or also from server administrator
View 1 Replies
View Related
Oct 19, 2007
I am currently creating a report with SQL Server Reporting Service 2005 and have run into an issue where the user can change the value in a drop down and the report will reload without any data. Data will not show untill the "View Report" button is clicked. Is there any way to avoid the page reloading like this so that the user is not confuesed by the lack of data ans just thinks that nothing was suppose to show up?
Thanks in advance.
View 4 Replies
View Related
Jun 7, 2006
Hello.
I'm importing some data from an excel file to sql server 2005.
I created an Excel Data Source inside my Data Flow Task but it is assuming that the source columns DataType is double-precision float [DT_R8]. It isn't, even though some rows may containg numeric string in the column's cell.
If I go to the Data Sources advanded editor, and modify the data type property of the column, SSIS complains the the error output and the source output are not of the same DataType. If I try to change the error output's data type in the advanced editor I get this error: "Property Value". The deailed error states:
Error at MOVIM 04 [MOVIM 04 [1]]: The data type for "output "Excel Source Error Output" (10)" cannot be modified in the error "output column "Agente Protector" (7662)".
Error at MOVIM 04 [MOVIM 04 [1]]: Failed to set property "DataType" on "output column "Agente Protector" (7662)".
If i let SSIS correct the error by itself, it changed the dource column back to double-precision float [DT_R8].
Is there any way to get arround this?
Thanks in advance,
Hugo Oliveira
View 11 Replies
View Related
Sep 10, 2007
Hello,
I am working on a project that involves one part where a field's value needs to be changed when the user updates the record. Here is the situation in detail:
There is an InputData table where the user enters new records or changes existing records. There is a field called "calculated" in this table which has a default value of 'no'. A stored procedure runs math calculations on all the InputData records where the calculated field = 'no'. At the end of this stored procedure, it sets the calculated field = 'yes'. When new records are added by the user their "calculated" field value is 'no' by default so that the next time the stored procedure is executed, it only runs the math calculations on the new records. The problem is, if a user changes an existing record, the "calculated" field needs to be changed from 'yes' to 'no' so that the stored procedure recalculates the math for the modified record. How do I change the value from 'yes' to 'no' on records that the user modifies?
Thanks.
View 9 Replies
View Related