How to replace data in sql command
Hi all
if i had one column data like
http://localhost:123
http://localhost:123 a
http://localhost:123 bg
http://localhost:123 fdasf
does any sql command line or method i can use to relace this column data?
the relace it should be like
http://127.0.0.1:123
http://127.0.0.1:123 a
http://127.0.0.1:123 bg
http://127.0.0.1:123 fdasf
regard
Hi all
if i had one column data like
COL1 COL2
http://localhost:123
http://localhost:123 a
http://localhost:123 bg
http://localhost:123 fdasf
does any sql command line or method i can use to
relace this column data?
the relace it should be like
COL1 COL2
http://127.0.0.1:123
http://127.0.0.1:123 a
http://127.0.0.1:123 bg
http://127.0.0.1:123 fdasf
regardselect replace(col1,'localhost','127.0.0.1') column1, col2 from table;
Good Luck
Similar Messages
-
How to select data from Sql server 2005 database tableinto oracle database table
Hi,
I have table text1 in sql server database and text2 in oracle database (11g). Now how to move data from SQL Server table into oracle table. So please help me how to do it.
Thanks a lot in advance.
rk
OS: Windows 7 professionalHi,
you can use export/import wizard and specify sql server as a source and oracle as destination.
I hope this is helpful.
Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
MCSE Data Platform
MCITP: SQL Server 2008 Administration/Development
MCSA SQL Server 2012
MCTS: SQL Server Administration/Development
MyBlog -
How do I write this SQL command in Oracle
Hi all
I wriote this SQ L statement in Ms SQL Server. How do I write this sql command in Oracle?
ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
I am very interested in this part:
SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007
thanks
Edited by: user631364 on Oct 27, 2008 8:25 AM
Edited by: user631364 on Oct 27, 2008 8:26 AM
Edited by: user631364 on Oct 27, 2008 8:27 AMThank you!!
Now let me aslk the second part of my question.
This sql command:
ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
was created with this query in SQL Server and then I saved it in a store procedure, that I scheduled to run montlhy
SET ANSI_NULLS ON
DECLARE @SQLString NVARCHAR(4000)
/* Build the SQL string once.*/
SET @SQLString = 'ALTER VIEW dbo.Consumption AS SELECT TOP 100 PERCENT ID, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
"'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 12) +
"'" +
' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
dbo.CONMonthInEnglish(getdate(), month(getdate()) - 12) +
… (GOES FROM current month -12 to current month -1)
, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
"'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 1) +"'" +
' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
dbo.CONMonthInEnglish(getdate(), month(getdate()) - 1) +
' FROM dbo.MasterConsumption WHERE YEAR_MONTH >= ' +
"'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-12 ) +"'" +
' AND YEAR_MONTH <= ' +
"'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-1 ) +"'" +
' GROUP BY ID ORDER BY ID '
EXEC sp_executesql @SQLString
Is that something that can be done in Oracle in the same way?
Do you use another approach?
please advice
Edited by: user631364 on Oct 27, 2008 10:19 AM
Edited by: user631364 on Oct 27, 2008 10:21 AM
Edited by: user631364 on Oct 27, 2008 10:21 AM
Edited by: user631364 on Oct 27, 2008 10:22 AM
Edited by: user631364 on Oct 27, 2008 10:23 AM
Edited by: user631364 on Oct 27, 2008 10:23 AM
Edited by: user631364 on Oct 27, 2008 10:24 AM -
How to aggregate data in SQL Query
Hi,
I have Table1 field1 and field2. Combination of these fields form the key of this table.
Next I have Table2 with field3 and field4. field1 is the unique key for this table.
My query is:
select T2.field4||','||T1.field2 from T1 inner join T2 on T1.field1 = T2.field3;
In the result I want to aggregate the data by T2.field4
How do I that? Please help
Thanks in advance,
RajaHow to aggregate data in SQL Query By using aggregate functions and group by:
SQL> select object_type, count(*), sum(decode(status,'VALID',0,1)) inv_obs
2 from all_objects
3 group by object_type;
OBJECT_TYPE COUNT(*) INV_OBS
CONSUMER GROUP 2 0
INDEX PARTITION 970 0
TABLE SUBPARTITION 14 0
SEQUENCE 226 0
SCHEDULE 1 0
TABLE PARTITION 349 0
PROCEDURE 21 0
OPERATOR 57 0
WINDOW 2 0
PACKAGE 313 0
PACKAGE BODY 13 0
LIBRARY 12 0
PROGRAM 9 0
INDEX SUBPARTITION 406 0
LOB 1 0
JAVA RESOURCE 771 0
XML SCHEMA 24 0
JOB CLASS 1 0
TRIGGER 1 0
TABLE 2880 0
INDEX 4102 0
SYNONYM 20755 140
VIEW 3807 72
FUNCTION 226 0
WINDOW GROUP 1 0
JAVA CLASS 16393 0
INDEXTYPE 10 0
CLUSTER 10 0
TYPE 1246 0
EVALUATION CONTEXT 1 0 -
How to import data from SQL server to Oracle?
Dear Sir/Madam,
I want to move database data from SQL Server to Oracle, but don't how to do it, will you please help me do it?Oracle Migration Workbench is your best bet:
http://www.oracle.com/technology/tech/migration/workbench/index.html
Cheers, OTN -
How to create backup using sql commands
can i create a backup using sql/sqlplus commands
I would actually advice you to use RMAN, instead of backup using sql commands, but if you want or have a requirment to do so..
First off all you should ensire that your databasse is in archilog mode.. (ALL PRODUCTION DATABASES should be in archivelog mode)
you can do it using sql*plus
archive log list
Then if you would like to make a cold backup (the only one posible in noarchivelog mode)
ypu have to
shutdown immediate
copy all database files (you don't need to copy redo logs) to another device
startup - to startup database
Actually I will suggest that your read User manager Recovery guide from oracle documentation
tahiti.oracle.com
Best Regards
Krystian Zieja / mob -
HOW TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE??
NEED TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE.
this is another method
http://www.mssqltips.com/sqlservertip/2484/import-data-from-microsoft-access-to-sql-server/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to view previously executed sql commands?
Hi experts,
I want to view the sql commands executed in Oracle 8i before 3 or 4 hrs.That is i am asking to view the command history.Can any one help me in this weird situation?Anytype of suggestion were welcme..
Thanx in Advance,
SenthilYou can use LOG MINER utility to check the commands that has been executed.
Use v$log_history view to check the exact log sequence number of the redo log file, and there by you can use that log file with log miner.
Using this method you can't see the DQL commands that has been executed against the database, apart from this all other commands can be seen..
cheers
kumareshan -
How to create db using sql commands?
Had logged in to default database with the default login nmae and password. Under this default database, am i able to create another database in it? If so, what is the sql command to create/delete the new db?
Chapter 2
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96521.pdf
Joel P�rez -
How to group data from SQL queries in XMLP Enterprise Edition
Hi all,
I have installed XMLP EE on a windows machine. I tried creating the data set with the type as SQL Query. In my case I have just joined the EMP and DEPT tables from the SCOTT schema:
select EMP.EMPNO as EMPNO,
EMP.ENAME as ENAME,
EMP.JOB as JOB,
DEPT.DNAME as DNAME,
EMP.DEPTNO as DEPTNO
from SCOTT.EMP EMP,
SCOTT.DEPT DEPT
where DEPT.DEPTNO=EMP.DEPTNO
and DEPT.DNAME = nvl(:DeptName,DEPT.DNAME )
I want that the data should be displayed in my report so that for each value of DNAME all the details (EMP.EMPNO, EMP.ENAME, EMP.JOB ) should be displayed as in master detail format in my XML output, so that it is easier to build the template using the <?for-each?> tags.
Can anyone suggest how I can do this?
I am facing another error :
The report cannot be rendered because of an error, please contact the administrator.
Can anyone help me with this too?
Thanks.Hi
On the error, have you tried running the report to generate data only ? If that is failing then you have an issue with your query or connection
On the grouping, hopefully you have the Template Builder installed. That can help you build the grouping you want in the output. For this report and to get you started check out the Table Wizard. There is a screen in that flow allowing you to specify Grouping criteria.
the following blog article may help too:
http://blogs.oracle.com/xmlpublisher/2007/05/03#a265
and this getting started with templates doc
http://www.oracle.com/technology/products/xml-publisher/xmlpclient.html
Regards
Tim -
How to pull data from sql server ( Seperate server) & upload it into sap
Hi All,
I have a SQL Server database in System1,
data base name DB1
Table name TB1
I want pull data from TB1 & upload the same into ztable in SAP.
How I can I achive this in ABAP.
Thanks in Advance
Appropriate points will be rewarded.
Arun kumarHi Arun,
You have to do the following:
1. Create an entry in Trxn DBCA for SQL Server in SAP, you are creating a database connection for the SQL server in SAP.
2. You use this connection, and write Native SQL stmnts...between EXECSQL...ENDEXEC to fetch the data..and then normal ABAP statements to put that data into your ztable.
Regards,
Raj
For eg:
TABLE DBCON Entry can be like this...depends on your External database..
CON_NAME Raj Logical name for connection
DBMS MSS Microsoft SQL Server
USER_NAME <User name> For SQL Serve
PASSWORD <password> " "
CON_ENV MSSQL_SERVER=<server> MSSQL_DBNAME=<database name>
DB_RECO Availability type for an open database connect
FUNCTION z_houston_connect.
""Local interface:
EXEC SQL.
CONNECT TO 'RAJ' AS 'V'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'V'
ENDEXEC.
*- Get the data from MS-SQL Server
EXEC SQL.
open C1 for
select
l.loc_id,
l.loc_name,
a.acc_id,
a.acc_name,
d.person
from ho_loc_mast as l
inner join snd_acc_mast as a on l.loc_id = a.loc_id
inner join snd_acc_addr as d on a.loc_id = d.loc_id and
a.acc_id = d.acc_id
where l.loc_id = '001'
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C1 into :wa-c_locid, :wa-c_locname, :wa-c_acc_id, :wa-c_acc_name, :wa-c_person
ENDEXEC.
IF sy-subrc = 0.
PERFORM loop_output.
ELSE.
EXIT.
ENDIF.
ENDDO.
EXEC SQL.
CLOSE C1
ENDEXEC.
ENDFUNCTION. -
How to pull Data from SQL server in FDM
Hi Experts
How to pull the HFM data from One SQL server to Another SQL Server using integration scripts in FDQM?
regards
DevCould you clarify why you want to do this?
If you are trying to synchronize two databases (apps) to have a backup or something running in a development environment, I would suggest configuring replication between the two databases. It would be much more efficient to do this at the SQL Server level than through the FDM application, IMHO.
Charles -
How to move data from Sql Server 2008 R2 to Visual Foxpro 6.0 dbf file format
I have some data that resides in SQL that needs to be automated via a SSIS package to create the output to a Visual Foxpro 6.0 format for use by another application that cannot access the SQL server.
How can this be done with SSISuse the OLEDB provider from Microsoft http://www.microsoft.com/en-us/download/details.aspx?id=14839
Arthur My Blog -
How to retrieve data from SQL server?
I'm thinking this is a request for plug-ins as I'm not aware that Indesign CS3 can hook into a SQL server.
Specifically, I'm trying to connect to a data server which has a built-in "SQL Stored Procedure" which will give me access to this database? I'm trying to avoid dumping into a intermediate data file, like Excel or XML.
What pointers should I try to look into? thanx, samI would say it depends on what you need to do. There are a few good plugins for InDesign out there that can hook up to a database, easycatalog by 65 bit http://www.65bit.com and Cacidi http://www.cacidi.com are some of the high end plugins that I can recommend, but the question is if cost outweights need. Both in their full version are quite costly.
If you can give a better description of what you need to do it might be easier to recommend a solution. -
How to capture data at exit command in module pool
hello all,
i have a scenario,on screen i enter some data and i press the cancel button a popup should be displayed saying do you want to cancel.if i press on yes then leave to screen 0.but if i press no then the previous data entered should be displayed on the same screen.
can some body help me on this.
Thanks,
Mayank.....Hi,
Create a button with type 'E' and
call a POP UP FM 'POPUP_TO_CONFIRM' and write the code to return to the place where you want to.
All the you need to write at at exit command.
The code is like this:
REPORT ztest_at_exit.
DATA:
var1(10),
var2(10),
var3(10).
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTEST_AT_EXIT'.
SET TITLEBAR 'ZTEST_AT_EXIT'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
DATA:
w_ucomm LIKE sy-ucomm.
w_ucomm = sy-ucomm.
CASE w_ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'ADD'.
var3 = var1 + var2.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module EXIT_100 INPUT
text
MODULE exit_100 INPUT.
DATA:
answer.
w_ucomm = sy-ucomm.
CASE w_ucomm.
WHEN 'EXIT2'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'Do you want to save this ?'
IMPORTING
answer = answer.
exception
text_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
IF NOT answer EQ '1'.
LEAVE TO SCREEN 0.
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE. " EXIT_100 INPUT
Regards,
Rama Chary.P.
Maybe you are looking for
-
Screen backlight and keyboard backlight not working
Yesterday I turned on my old but proud PowerBook17" and the *screen was black*, but you could barely see everything. *Also keyboard backlight is not working.* I read many many forums and all say that black screen caused by inverter failure, but in my
-
Inserting Bridge Photo Gallery into webpage
I have made the changes to the web gallery index page (from Bridge) as indicated in http://foundationphp.com/tutorials/gallery/embed3.php in DW. However, I normally do not use DW, but need to now. I have the new web page where I want the gallery t
-
Can I filter movies for rentals only?
Is it possible in iTunes store to filter so I see ONLY RENTAL movies? I almost NEVER buy movies. I might buy one for every 100 movies I watch. I watch a LOT of movies, on Netflix, Amazon and other sites. I would like to rent at Apple Store more of
-
logic pro 9 comes on however it will not allow me to go into my libary as soon as i push the tab it crashes,i have updated the program change the proapps and copy the libary and still no results so what do i do now i have snowleapard and its a 10.6 h
-
Macbook Pro, mid 2014, OSX Yosemite 10.10.2