Query on SQL UPDATE
Hi,
A small query regarding the SQL Update......
I have the below table values where I want to update two columns.....
EmpID EmpName Sal DocID DocSeqNum CreaDate
========================================
1 XYZ 25 289 1 12-MAY-2012
2 XYZ1 50 289 2 12-MAY-2012
3 XYZ2 55 NULL NULL 14-MAY-2012
4 XYZ3 60 NULL NULL 14-MAY-2012
5 XYZ4 65 NULL NULL 14-MAY-2012
6 XYZ5 70 NULL NULL 13-MAY-2012
I want to update the DocID with value 289 and DocSeqNum with a sequence i.e 3, 4, 5, 6 etc.....
Please advise.
THanks
Maybe just (for this particular case)
update the_table
set docid = 289,
docseqnum = empid
where coalesce(docid,docseqnum) is nullor
merge into the_table t
using (select empid,289 sal,row_number() over (order by empname) docid
from the_table
) u
on (t.empid = u.empid)
when matched
then update
set t.sal = u.sal,
t.docid = u.docid
where coalesce(docid,docseqnum) is nullRegards
Etbin
Similar Messages
-
Multiple SQL Update within Parent Query
I am tring to extract an image from within a MS SQL image field,
opening the image using JAI, getting the src.getWidth() & src.getHeight
() of each item within the database, and then writing the width and
height back into the database. Everything works except when I goto
write the values into the database - the page (when loading) continues
to work and work and work until I restart the tomcat service. I do not
understand why this would occur, and what is even stranger - I have
very similar code i used for resizing images in the database into a
thumbnail - display and original file sizes using a similar approach...
and that works with out a problem...
I have tried the code with out the inner update query - it works. I
tried with just the selection of a single specific item in the first
query and that works, but when I try multiple updates the second query
appears to stall.
The code is as follows.:
<%@ page language="java" import="javax.servlet.*,javax.servlet.http.*,java.io.*,java.util.*,java.sql.*,javax.media.jai.*,java.awt.*,java.awt.image.*,java.awt.Graphics.*,java.awt.geom.*,java.awt.image.renderable.*,javax.media.jai.widget.*,com.jspsmart.upload.*,java.net.*,com.sun.media.jai.codec.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%
// Variables
int count=0;
int width = 0;
int height = 0;
String vFileName = "";
String vFileExt = "";
String vFileID = "";
String format = "0";
// Connect to the database
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://206.152.227.62:1433;DatabaseName=WWWBBD;User=wwwbbd;Password=bbd1412");
//Create the statement
Statement sqlGetPics = con.createStatement();
Statement sqlUpdate = con.createStatement();
//build the query
String qryGetPics = "SELECT TOP 5 FileID, FileExt, FileName, AdjFile = CASE WHEN FullFile IS NULL THEN Display ELSE FullFile END FROM FileStore WHERE (UPPER(FileExt) = '.JPG' OR UPPER(FileExt) = '.TIF' OR UPPER(FileExt) = '.GIF' OR UPPER(FileExt) = '.BMP') AND (NOT Display IS NULL OR NOT FullFile IS NULL)";
//execute the query
ResultSet rsGetPics = sqlGetPics.executeQuery(qryGetPics);
// Initialization
SmartUpload uploader = new SmartUpload();
uploader.initialize(getServletConfig(),request,response);
mySmartUpload.initialize(getServletConfig(), request, response);
// Upload
mySmartUpload.upload();
while (rsGetPics.next()) {
vFileID = rsGetPics.getString("FileID");
vFileExt = rsGetPics.getString("FileExt");
vFileName = rsGetPics.getString("FileName") + vFileExt;
width = 0;
height = 0;
uploader.fieldToFile(rsGetPics, "AdjFile", "/upload/" + vFileName);
if (vFileExt.equalsIgnoreCase(".JPG") || vFileExt.equalsIgnoreCase(".JPEG"))
format = "JPEG";
else if (vFileExt.equalsIgnoreCase(".TIF") || vFileExt.equalsIgnoreCase(".TIFF"))
format = "TIFF";
else if (vFileExt.equalsIgnoreCase(".GIF"))
format = "JPEG";
else if (vFileExt.equalsIgnoreCase(".BMP"))
format = "BMP";
else
format = "0";
// update the width & height
if (format != "0")
try
//Opens the image
RenderedImage src = JAI.create("fileload","d:\\servers\\tomcat\\webapps\\jsp\\upload\\" + vFileName);
width = src.getWidth();
height = src.getHeight();
java.io.File imageFile = new java.io.File("d:\\servers\\tomcat\\webapps\\jsp\\upload\\" + vFileName);
InputStream is = new FileInputStream(imageFile);
//build the query
String qryUpdate = "UPDATE FileStore SET Width = " + width + ", Height = " + height + " WHERE FileID = " + vFileID;
//execute the query
ResultSet rsUpdate = sqlUpdate.executeQuery(qryUpdate);
%>[<%=width%>x<%=height%>:<%=vFileID%>:<%=qryUpdate%>]<BR><%
catch(Exception e)
{out.println("An error occurs : " + e.toString());}
count++;
//rsUpdate.close();
sqlUpdate.close();
%>
<HTML>
<HEAD>
<TITLE>Repair Files</TITLE>
</HEAD>
<BODY>
<%=count%> files updated in the database.
</BODY>
</HTML>BTW - I also tried this with a prepared statment query... no good.
-
Start SQL-Update query on click
Hi,
I would like to start in a JSP am JSTL-Update when the user clicks on a button.
Unfortunately, I have not found any hint how to do that!
Can someone give me some advise how this can be done?
I have the following code:
<sql:setDataSource dataSource="jdbc:oracle:thin:@<IP-address>:1521:<SID>,oracle.jdbc.driver.OracleDriver,<user>,<password>" var="datasource1"/>
<sql:update var="insert1" sql="insert into table (column1,column2,column3,column4) select sysdate,column1,column2,column3 from <table2>" dataSource="${datasource1}"/>
But I have no idea how to associate it with the click on a button.
Best regards.What proportion of each column has a -1 value?
Will the -1 value be in only one of the columns for each row or could there be multiple -1 values in a row?
How big is the table?
If only a small portion has a -1 and only one column per row could have -1, then seperate updates might be more efficient since only the columns that require updating will be touched. On the other hand, if several columns in a row could have -1 or if most rows would have at least one column with a -1, a single update might be more efficient since each row that requires multiple updates would only be touched once.
John -
SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row
I have a region with the following type:
SQL Query (PL/SQL Function Body returning SQL query).
In a search screen the users can enter different numbers, separated by an ENTER.
I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
It's something like this:
If (:P30_POD Is Not Null) Then
v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
v_condition := ' AND ';
End If;
But the query doesn't return any rows.
I tried to reproduce it in Toad:
select * from asx_worklistitem
where
POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
==> This is the query that does't return any rows
select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
from dual;
==> This returns '541449200000171813','541449206006341366'
select * from asx_worklistitem
where pod in ('541449200000171813','541449206006341366');
==> and when I copy/paste this in the above query, it does return my rows.
So why does my first query doesn't work?
Doe anyone have any idea?
Kind regards,
Geert
Message was edited by:
ZorryThanks for the help.
I made it work, but via the following code:
If (:P30_POD Is Not Null) Then
v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
v_where := v_where || v_condition || 'POD IN (';
v_counter := 1;
WHILE (v_counter < LENGTH(v_pods)) LOOP
v_pod := SUBSTR(v_pods, v_counter, 18);
IF (v_counter <> 1) THEN
v_where := v_where || ',';
END IF;
v_where := v_where || '''' || v_pod || '''';
v_counter := v_counter + 18;
END LOOP;
v_where := v_where || ')';
v_condition := ' AND ';
End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
Because I think this will have a lot of overhead.
I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible? -
Code to run a query in SQL from Access with pass through query
I have a query in SQL Server 2008:
[Auto Null Up Date].sql. I want to run this query from Access 2007 using a Pass Through Query. What is the command/code to run this query from Access? I have used Pass Through Queries but never in this capacity so I am somewhat lost. I have
already established the OBDC link and tested.Naomi,
Here are a few lines of the SQLCMD code in the [Auto Null Update].sql query:
USE [Archive Master]
Go
:r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null BackPress 2 update.sql"
GO
:r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 3 update.sql"
GO
:r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 4 update.sql"
When this code is pasted into a Create Procedure, (the USE [Archive Master] is not used), the procedure will run, but once saved here is what is left of the procedure once I attempt to modify:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
<Author,,Name>
-- Create date: <Create Date,,>
-- Description:
<Description,,>
-- =============================================
Create PROCEDURE [dbo].[NullTest2]
AS -
UPDATE QUERY can't update table
Hi,
During 1500-2000 concurrent users, DB Transaction locks occur. So that Update query can't update table and we get inconsistent data. How can we avoid this inconsistent data?? Why we get transaction locks??
Eg. In update query it update the status of user with completed; but because of transaction lock update query can't update status of user it remains uncompleted. So we can get wrong status of user(inconsistent data). Why UPDATE query update the status
of user???
update table set status='completed', date=@p2,score=@p3 where id=@p1You are not getting inconsistent data, you are getting the data according to the isolation level you are running under. The isolation level determines the locking model and therefore determines any bad dependencies you may experience. Reducing the bad dependencies
through higher isolation level will lower concurrency. *This* is the core concept of Transactional Processing theory.
Furthermore there is not really such a thing as a DB Transaction lock - at least not in the way you mean. SQL server does use DB locks (such as Shared transaction workspace and Exclusive transaction workspace) but the highest level of lock escalation is
the object level (heap or btree) so those are the things you are really interested in. In the ideal would you want all Exclusive, Shared and U locks to be taken at the RID (heaps) or Key (cluster tables) level - and only have few of them per query.
In conclusion think carefully about your query and how it is implimented under the covers by the database engine.
Regards,
Mark Broadbent.
Microsoft Certified Master
Contact me through twitter |
blog | sqlcloud
Please click "Propose as answer" if a post solves your problem
or/and vote the post up if it's been helpful. -
Get definition of an index from query in SQL Server
Hi,
I need to get definition of an index using query in SQL Server 2008 as we can get definition of a stored procedure using sp_helptext command.
Thanks In advance,
JiteshI have worked on the script and updated the script as per my need. Now I am able to generate the script for a specific index. Here is the script:-
CREATE PROCEDURE ScriptCreateDropIndexes_SP
@TableName SYSNAME
,@SchemaName SYSNAME = 'dbo'
,@SORT_IN_TEMPDB VARCHAR(3) = 'OFF'
,@DROP_EXISTING VARCHAR(3) = 'OFF'
,@STATISTICS_NORECOMPUTE VARCHAR(3) = 'OFF'
,@ONLINE VARCHAR(3) = 'OFF'
,@Index_Name NVARCHAR(1000)
,@is_Create int = 0
AS
Parameters
@Schemaname - SchemaName to which the table belongs to. Default value 'dbo'.
@Tablename - TableName for which the Indexes need to be scripted.
@SORT_IN_TEMPDB - Runtime value for SORT_IN_TEMPDB option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@DROP_EXISTING - Runtime value for DROP_EXISTING option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@STATISTICS_NORECOMPUTE - Runtime value for STATISTICS_NORECOMPUTE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@ONLINE - Runtime value for ONLINE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
SET NOCOUNT ON
IF @SORT_IN_TEMPDB NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @SORT_IN_TEMPDB is ON \ OFF',16,1)
RETURN
END
IF @DROP_EXISTING NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @DROP_EXISTING is ON \ OFF',16,1)
RETURN
END
IF @STATISTICS_NORECOMPUTE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @STATISTICS_NORECOMPUTE is ON \ OFF',16,1)
RETURN
END
IF @ONLINE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @ONLINE is ON \ OFF',16,1)
RETURN
END
DECLARE @IDXTable TABLE
Schema_ID INT
,Object_ID INT
,Index_ID INT
,SchemaName SYSNAME
,TableName SYSNAME
,IndexName SYSNAME
,IsPrimaryKey BIT
,IndexType INT
,CreateScript VARCHAR(MAX) NULL
,DropScript VARCHAR(MAX) NULL
,ExistsScript VARCHAR(MAX) NULL
,Processed BIT NULL
INSERT INTO @IDXTable
Schema_ID
,Object_ID
,Index_ID
,SchemaName
,TableName
,IndexName
,IsPrimaryKey
,IndexType
SELECT ST.Schema_id
,ST.Object_id
,SI.Index_id
,SCH.Name
,ST.Name
,SI.Name
,SI.is_primary_key
,SI.Type
FROM SYS.INDEXES SI
JOIN SYS.TABLES ST
ON SI.Object_ID = ST.Object_ID
JOIN SYS.SCHEMAS SCH
ON SCH.schema_id = ST.schema_id
WHERE SCH.Name = 'dbo'
AND ST.Name = 'group_master'
AND SI.name = 'uq_group_master__parent_id'
AND SI.Type IN (1,2,3)
DECLARE @SchemaID INT
DECLARE @TableID INT
DECLARE @IndexID INT
DECLARE @isPrimaryKey BIT
DECLARE @IndexType INT
DECLARE @CreateSQL VARCHAR(MAX)
DECLARE @IndexColsSQL VARCHAR(MAX)
DECLARE @WithSQL VARCHAR(MAX)
DECLARE @IncludeSQL VARCHAR(MAX)
DECLARE @WhereSQL VARCHAR(MAX)
DECLARE @SQL VARCHAR(MAX)
DECLARE @DropSQL VARCHAR(MAX)
DECLARE @ExistsSQL VARCHAR(MAX)
DECLARE @IndexName SYSNAME
DECLARE @TblSchemaName SYSNAME
SELECT @TblSchemaName = QUOTENAME(@Schemaname) + '.' + QUOTENAME(@TableName)
SELECT @CreateSQL = ''
SELECT @IndexColsSQL = ''
SELECT @WithSQL = ''
SELECT @IncludeSQL = ''
SELECT @WhereSQL = ''
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE CreateScript IS NULL)
BEGIN
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@isPrimaryKey = IsPrimaryKey
,@IndexName = IndexName
,@IndexType = IndexType
FROM @IDXTable
WHERE CreateScript IS NULL
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY Index_ID
IF @isPrimaryKey = 1
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' ALTER TABLE '+ @TblSchemaName + ' DROP CONSTRAINT [' + @IndexName + ']'
END
ELSE
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' DROP INDEX [' + @IndexName + '] ON ' + @TblSchemaName
END
IF @IndexType IN (1,2)
BEGIN
SELECT @CreateSQL = CASE
WHEN SI.is_Primary_Key = 1 THEN
'ALTER TABLE ' + @TblSchemaName
+ ' ADD CONSTRAINT [' + @IndexName + '] PRIMARY KEY ' + SI.type_desc
WHEN SI.Type IN (1,2) THEN
' CREATE ' + CASE SI.is_Unique
WHEN 1 THEN ' UNIQUE ' ELSE '' END + SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
END
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ CASE SIC.is_descending_key
WHEN 0 THEN ' ASC '
ELSE 'DESC'
END + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' IGNORE_DUP_KEY = ' + CASE SI.ignore_dup_key WHEN 1
THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB
+',DROP_EXISTING = ' + @DROP_EXISTING + ',' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
' STATISTICS_NORECOMPUTE = ' + @STATISTICS_NORECOMPUTE
+ ', SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB +
', ONLINE = ' + @ONLINE + ') ON ' + QUOTENAME(SFG.Name)
,@IncludeSQL = ( SELECT QUOTENAME(SC.Name) + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID
= SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 1
ORDER BY SIC.Key_Ordinal
FOR
XML PATH('')
,@WhereSQL = SI.Filter_Definition
FROM SYS.Indexes SI
JOIN SYS.FileGroups SFG
ON SI.Data_Space_ID =SFG.Data_Space_ID
WHERE Object_ID = @TableID
AND Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
IF LTRIM(RTRIM(@IncludeSQL)) <> ''
SELECT @IncludeSQL = ' INCLUDE (' + SUBSTRING(@IncludeSQL,1,LEN(@IncludeSQL)-1) + ')'
IF LTRIM(RTRIM(@WhereSQL)) <> ''
SELECT @WhereSQL = ' WHERE (' + @WhereSQL + ')'
END
IF @IndexType = 3
BEGIN
SELECT @CreateSQL = ' CREATE ' + CASE
WHEN SI.Using_xml_index_id IS NULL THEN ' PRIMARY '
ELSE '' END
+ SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = OFF,DROP_EXISTING
= OFF,' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
'SORT_IN_TEMPDB = OFF ' + ') '
,@IncludeSQL = ' USING XML INDEX [' + (SELECT Name
FROM SYS.XML_Indexes SIP
WHERE SIP.Object_ID = SI.Object_ID
AND SIP.Index_ID = SI.Using_XML_Index_ID) + '] FOR PATH '
FROM SYS.XML_Indexes SI
WHERE SI.Object_ID = @TableID
AND SI.Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
END
SELECT @CreateSQL = @CreateSQL
+ @IndexColsSQL + CASE WHEN @IndexColsSQL <> '' THEN CHAR(13) ELSE ''
END
+ ISNULL(@IncludeSQL,'') + CASE WHEN @IncludeSQL <> '' THEN CHAR(13) ELSE
'' END
+ ISNULL(@WhereSQL,'') + CASE WHEN @WhereSQL <> '' THEN CHAR(13) ELSE
'' END
--+ @WithSQL
UPDATE @IDXTable
SET CreateScript = @CreateSQL
,DropScript = @DropSQL
,ExistsScript = @ExistsSQL
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
-- PRINT REPLICATE('-',100)
-- PRINT 'DROP Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 0
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF ' + ExistsScript + CHAR(13) + DropScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end
--PRINT REPLICATE('-',100)
--PRINT 'Create Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 1
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF NOT ' + ExistsScript + CHAR(13) + CreateScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end -
How can i write jstl with jsp in sql:update ,when it give sqlException"
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<sql:query var="login" dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul">
SELECT * FROM login;
</sql:query>
<html>
<head>
<title>login information</title>
</head>
<body>
<h1>login information</h1>
<table border="1">
<tr>
<th>id</th>
<th>login</th>
<th colspan="2">password</th>
</tr>
<c:forEach var="round" items="${login.rows}" >
<tr>
<td>${round.id}</td>
<td>${round.login}</td>
<td colspan="2">${round.password}</td>
</tr>
</c:forEach><tr>
<form name="round-input" action="round_process.jsp" method="POST">
<td><input name="id" type="text" size="20" /></td>
<td><input name="login" type="text" size="20" /></td>
<td><input name="password" type="text" size="20" /></td>
<td><input type="submit" value="Update" /></td>
</form>
</tr>
</table>
</body>
</html>
it pass the parameter in round_process.jsp
<!--
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
-->
<sql:query var="login" dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul">
SELECT * FROM login WHERE id=?
<sql:param value="${param.id}"/>
</sql:query>
<sql:update>
INSERT INTO login(id,login,password)VALUES(?,?,?)
<sql:param value="${param.id}"/>
<sql:param value="${param.login}"/>
<sql:param value="${param.password}"/>
</sql:update>
<c:redirect url="round-input.jsp"/>
when i execute the second .jsp page it will show an exception and error that is
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "null"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.round_005fprocess_jsp._jspService(round_005fprocess_jsp.java:87)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "null"
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.getConnection(UpdateTagSupport.java:234)
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doStartTag(UpdateTagSupport.java:115)
org.apache.jsp.round_005fprocess_jsp._jspx_meth_sql_update_0(round_005fprocess_jsp.java:168)
org.apache.jsp.round_005fprocess_jsp._jspService(round_005fprocess_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.Your problem is that you need to have a
<sql:setDataSource
var="myDataSource"
dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul"
/>and your sql:query would now be
<sql:query var="login" dataSource="${myDataSource}">
SELECT * FROM login;
</sql:query>You can use whatever name you want for the var in the setDataSource as long as it matches the dataSource in the query. -
Add members to collection from sql updatable report.
I have created a collection based on a query (collection_name = 'EMP_COLLECTION' query = select name, ssn, dept from emp.
The collection is created perfectly.
Now, I have a page with a SQL-updatable Report based off of the collection
(select * from htmldb_collection where collection_name = 'EMP_COLLECTION'. The collection rows appear, and I am able to press an ADD button to add a row. I fill in the data using the key DEPT which a pull from a field stored on the page.
How can I reference the other fields in the collection...#NAME#, #SSN# (as they are not items on the page).
Please let me know if you need clarification on this question as I realize I am a bit out of my league in describing it....but could really use a tip.
KarenKaren,
I recently began working on collections, so here are a few code snippets that may help you:
Create Collection (placed in a Before Header Page Process)
apex_collection.create_or_truncate_collection
(p_collection_name => 'SOME_COLLECTION');
Initially populate a collection with default values (placed in a Before Header Page Process)
DECLARE
i number;
cntr number := 5; -- Sets number of default entries in collection
BEGIN
for i in 1..cntr loop
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'SOME_COLLECTION',
p_c001 => 0, --Unique ID
p_c002 => :P10_ITEM_NM, -- Item Name
p_c003 => NULL, -- Description
p_c004 => sysdate, -- Date of Entry
end loop;
END;
each p_cXXX is a reference to a column in the collection.
View existing collection
SELECT SEQ_ID,
c001 ID,
c002 ITEM_NM,
c003 ITEM_DESC,
c004 ITEM_ENTRY_DATE,
from APEX_COLLECTIONS
where COLLECTION_NAME = 'SOME_COLLECTION'
You can also turn this into an editable collection by going into the report and individually changing the fields to text fields, dropdowns, etc.
To Update a collection (On Submit, After computations Page Process)
declare
c pls_integer := 0;
begin
for c1 in (
select seq_id from apex_collections
where collection_name = 'SOME_COLLECTION'
order by seq_id) loop
c := c+1;
--Item Name
apex_collection.update_member_attribute (p_collection_name=> 'SOME_COLLECTION',
p_seq=> c1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f01(c));
--Item Description
apex_collection.update_member_attribute (p_collection_name=> 'SOME_COLLECTION',
p_seq=> c1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f02(c));
--Item Entry Date
apex_collection.update_member_attribute (p_collection_name=> 'SOME_COLLECTION',
p_seq=> c1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f03(c));
end loop;
end;
In this example, the ID field is hidden to the users and populated using a sequence. The other fields are presented as text fields for Item Name and Item Description and a Date Picker for the Item Entry Date.
The key to understanding this is that the attribute number indicated by p_attr_number references the column in the COLLECTION containing the value you want to update/overwrite. The g_fXX tells which of the updatable columns in your report provide the values for the columns. Keep in mind that the number of updateable columns in your report is likely fewer than the total number of columns, so the numbering here starts from the first updatable column and goes down. If you rearrange the order of the columns in the display, it will not alter the field in the collection you reference (the attribute), but it WILL alter the g_fXX notation you use to get the value from.
Writing to the DB
declare
begin
for c1 in (select TO_NUMBER(c001) row_id, c002 itm_nm, c003 itm_desc,
to_date(c004,'DD/MM/YYYY') itm_dt from APEX_COLLECTIONS
where COLLECTION_NAME = 'SOME_COLLECTION') loop
insert into ITEMS (ITEM_ID, ITEM_NAME, ITEM_DESC, ITEM_DATE)
values (c1.row_id, c1.itm_nm, c1.itm_desc, c1.itm_dt);
end loop;
end;
Here, the trick is to reference the items using the [collection name].[attribute alias] syntax. This avoids the Oracle error "can't use a column".
If you want to reference items not on the page and put them into the collection, I recommend pre-populating them, since the user isn't going to be able to alter something they can't see anyway. I have used this successfully with both page items and application items.
Cheers. -
TSQL - Dynamic Query Case statment update issue - to update table by left shifting the rows
Hi all
I need an help on my tsql query in 2000 to fix the case statement.
I have a table like shown below.
On this table where ever I see PortID as 101 and 105 I need to remove it and shift the rows from right to left.
ie on First row PortID1 is 101 so I need to remove it and replace it with PortId2 and similarly PortID2 replaced my PortID3 and so on.
ie like on excel if you delete cell we need to shift the rows to left .
I wrote an dynamic update statement i,m not sure on the assigning dynamic case statment.
CREATE TABLE [TravelRank]
[Destination] [varchar] (50) NULL,
[PortID1] [int] NULL ,
[Distance1] [int] NULL ,
[Rating1] [int] NULL ,
[PortID2] [int] NULL ,
[Distance2] [int] NULL ,
[Rating2] [int] NULL ,
[PortID3] [int] NULL ,
[Distance3] [int] NULL ,
[Rating3] [int] NULL ,
[PortID4] [int] NULL ,
[Distance4] [int] NULL ,
[Rating4] [int] NULL
INSERT into [TravelRank]
select 'Virgin Islands','101','10','5','102','20','5','103','31','5','109','41','5'
Union all
select 'Guinea','101','15','3','102','22','3','105','32','2','110','45','4'
Union all
select 'Benin ','102','12','4','106','28','4','104','33','3','109','48','2'
Union all
select 'Ecuador','102','18','5','101','29','5','108','34','1','111','45','5'
Union all
select 'Belarus ','103','17','4','105','24','4','108','45','4','112','46','3'
Union all
select 'Cook Islands','105','11','2','108','23','2','101','32','2','107','42','4'
Here is my code to fix
declare @SQL varchar(4000)
declare @left varchar(1)
declare @right varchar(1)
select @left = '1',@right = '2'
while @left < 4
begin
select @SQL = '
update t1.PortID' + @left + ' = t2.PortID' + @right + '
t1.Distance' + @left + ' = t2.Distance' + @right + '
t1.Rating' + @left + ' = t2.Rating' + @right + '
'case @left
when '1' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+3 as varchar(1)) +'
' when '2' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
' when '3' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
' when '3' then
' t1.PortID' + @left + ' = null '
t1.Distance' + @left + ' = null '
t1.Rating' + @left + ' = null '
else '' end'
from [TravelRank] t1
inner join [TravelRank] t2
on t1.destination = t2.destination
where t1.PortID1 = 101'
print @SQL
-- exec (@SQL)
select @left = cast(cast(@left as int) + 1 as varchar(1))
, @right = cast(cast(@right as int) + 1 as varchar(1))
end
Thanks a lot in advance.declare @SQL varchar(4000)
declare @left varchar(1)
declare @right varchar(1)
select @left = '1',@right = '2'
while @left < 4
begin
select @SQL = '
update t1.PortID' + @left + ' = t2.PortID' + @right + '
t1.Distance' + @left + ' = t2.Distance' + @right + '
t1.Rating' + @left + ' = t2.Rating' + @right + '
'+CASE @left
when '1' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+3 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+3 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+3 as varchar(1)) +'
' when '2' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.PortID' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+2 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+2 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+2 as varchar(1)) +'
' when '3' then
' t1.PortID' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.PortID' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Distance' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Distance' + cast(cast(@right as int)+1 as varchar(1)) +'
t1.Rating' + cast(cast(@left as int)+1 as varchar(1)) + ' = t2.Rating' + cast(cast(@right as int)+1 as varchar(1)) +'
' when '3' then
' t1.PortID' + @left + ' = null '+
' t1.Distance' + @left + ' = null '+
' t1.Rating' + @left + ' = null '
else '' END + '
from [TravelRank] t1
inner join [TravelRank] t2
on t1.destination = t2.destination
where t1.PortID1 = 101'
print @SQL
-- exec (@SQL)
select @left = cast(cast(@left as int) + 1 as varchar(1))
, @right = cast(cast(@right as int) + 1 as varchar(1))
end
You were missing a couple of concats. This runs now, but I'm not completely sure if it's the output you were expecting. -
SQL Update to split 1 column into 2
I have a column in a table that holds both a city and a zip ex. Jackson 44319
I am trying to write an sql update query so that the 2 pieces of info would be split and funneled into their own respective column. For example:
Before
column name: address
Jackson 44319
After
column name:city column name: zip
Jackson 44319
Here is what I have come up with so far, but it does not work correctly.
Update Table
Set city=Parsename(Replace(address ,',','.'),2),
zip=Parsename(Replace(address ,',','.'),1)
this query basically copies all my info from the address table and puts it into the zip table, and the city table remains null. yet, nothing gets split.Does your db have a bulk loading utility? Do you have access to text manipulation tools such as awk?
If so, using them is probably a better idea than using ColdFusion. -
Aspect logging - ie, trigger logging of sql:update
Is it possible to...somehow attach an aspect to a JSTL action?
In other words,
like, for every
</sql:update> tag, could I somehow trigger some code to log the query that was executed?
I would love to add logging to all non SELECT statements to my app, and if there is an easy way to ... say, wrap the SQL tld, that would be great!Can Log4j do this?
http://logging.apache.org/log4j/docs/index.html -
Is there a way to fire off an update query like:
Update devices set description = 'A' where description = 'B'
I get a "no update permission" error.
Yes, this a bad idea for many reasons, but I'm not willing to let that stop me, at least in this lab/test scenario...Thanks for the response Stephan and s. Sorry - the original post had a typo. I was using the proper table name.
I didn't realize that there was a command line option. I've been avoiding the command line because I don't know too much about it. The command line option worked:
admin:run sql update device set description= "Test" where name="SEP000000032081"
Rows: 1
admin:
Of course this morning, I get something totally different from AXL (but these are the actual reuest and response envelopes):
sent:
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
update device set description= 'Test' where name='SEP001BD458B533'
received:
http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
SOAP-ENV:Client
Method only for queries
http://www.cisco.com/AXL/API/1.0">
-79750
Method only for queries
executeSQLQuery -
SQL query (pl/sql function body returning query) performance issue
I create my report in building my sql instruction with ( SQL Query pl/sql function body returning sql query );
My report take more than 20 seconds however if i did a cut and paste with the sql code in TOAD the same sql take 1 second.
To try to discover the source of the problem; i take the sql generated by the function and i create another report ( sql query ) this new report take 2 seconds.
My query is very big 25,000 characters with database link.
What is the difference between SQL-quey and sql-query(pl/sql function body returning sql query)
Thanks
MarcMarc,
Firstly...don't compare the timings from Toad, since often Toad only fetches the first few records for you (i.e. it pages them).
Secondly....the database link could be a factor here, but without seeing your query it's too hard to say.
Can you post the query somewhere (on a webserver say)? -
Different output of same query in SQL Server and Oracle
I have two tables table1 and table2
--table1 has two columns c1 int and c2 varchar. there are not constraints added in it. it has data as given below
c1 c2
6 d
5 j
102 g
4 g
103 f
3 h
501 j
1 g
601 n
2 m
--table2 has only one column c1 int. there are not constraints added in it. it has data as given below
c1
6
1
4
3
2
now when i run below given query in sql server and oracle it gives me different result
select *
from table1
inner join (SELECT ROW_NUMBER() OVER (order by c1 ASC) AS c1 from table2) table2 on table2.c1=table1.c1
sql server output
c1 c2 c1
1 g 1
2 m 2
3 h 3
4 g 4
5 j 5
oracle output
C1 C2 C1
5 j 5
4 g 4
3 h 3
1 g 1
2 m 2
If you notice the first column in both output. It is sorted in sql server and not in oracle.
Why it is behaving differently in oracle? Is there any way I can solve this in oracle?
Thanks,
JigsIt is NOT behaving "differently" in Oracle; you just haven't specified an order that you expect your results to be in, so you're going to get output in whatever order the database fancies displaying it (ie. no guarenteed order). This is an artifact of how the database chooses to put together the data, and different databases (or even datasets within the same database) can and most likely will behave differently.
Even SQL Server won't guarentee to always get your data in an ordered fashion if you exclude the order by clause, even if you think it has always output the data in an ordered fashion.
Your solution is to add an order by clause, in BOTH databases, to force the order of the output data.
Maybe you are looking for
-
hi. i purchased flightradar24 apps from my iPad. can i share the same app on my macbook?
-
Photoshop Elements 4.0 and windows 7 compatibility.
I just recently purchased a new computer with windows 7 on it and have been trying to get my tablet and art programs on it, one of which it PE4.0. When trying to install it Im told that its incompatible, so I am wondering if there is someway to rect
-
Create more than one link to a document
I am a RoboHelp 6 user. I can only link to a Word document or PDF once, in other words if I create more than one link to a document, the second link is broken. I would appreciate it if anyone can tell me how I can get around this.
-
What's the process of replacing a cracked iPhone screen?
I dropped my iPhone 4S earlier and was wondering what to do to get the cracked screen replaced and how much I'd have to pay. Thanks
-
Stretched photos after editing with photoshop CS5
When I crop a photo with photoshop CS5 and then go and review it in Iphoto the picture looks like the unedited version in the "events" but when i double click on it it appears streteched. How do I fix this? Also, when I edit a photo with CS5 (for ex: