I HAVE TO RETRIEVE ID AND LAST_NAME FROM MY TABLE BUT THE THING IS THAT MY ID IS NOT CONTINUOUS AND THERE NO PATTERN FOR THE GAPS. NOW I WANT TO WRITE A PL/SQL ANONYMOUS BLOCK FOR THIS.
I want to display Years between From date - To date using oracle SQL on dual table
e.g.
if pass - From date as 1/1/1900 and To Date as 1/1/2000
then it shoold display
1900
1901
-
till
2000
i have 2 tables in access
this is what i need:
1. if the PK from table1 exists in table2, then delete the entire record with that PK from table2 and add the entire record from table1 into table2
2. if the PK does not exist then add the record
i need help with both the sql statement and the VBA
i guess the VBA should be a loop, going through every record in table1. inside the loop i should have the select statement
I have a subreport inside a main report on a new page due to the layout. When the subreport generates no data(sql table is empty), there is a blank page generated in the mainpage. How can i omit this empty page? please help me here..
Query:
select t1.col1
from table1 t1
inner join with (nolock) table2 t2 on t1.col2 = t2.col1
Am trying to use nolock option for optimized query in mySQL db, but for some reason the above query
does not work and the error i receive is
You have an error in your SQL syntax;
Any thoughts?
Is it possible to deceive SQL Server to return a different date on GetDate() without actually changing the machine date?
This would be great, since we have a database with old data and I'm trying to test some queries that use getdate().
I can change my machine date but that brings some other problems with other applications...
Any tips?
Thanks!
Hi,
I hv a table like this :-
Item Qty Price A Price B
abc 5 36.00 0
qwe 8 0 48.00
zxc 6 12.00 0
poi 4 10.00 0
lkj 9 12.00 0
mnb 3 0 14.00
vfr 7 0 6.00
How can I sum the value using SQL ie. if Price A is zero, it will pick Price B. The expected results will be as follows :-
Item Value
abc 180.00
qwe 384.00
zxc 72.00
poi 40.00
lkj 36.00
mnb 42.00
vfr 42.00
What tool for managing Oracle DB do you suggest? I need to execute scripts and manage data in tables and develop some scripts and packages. I'v tried SQL developer and actually don't like it. Want some more features for developing (debug, code assist, integrated help and so on.)
Finding it a little bit tedious migrating to the new Mysql Workbench (5.2.22) even though it has many more features than the older GUI tools. Right now I'm confused why I can't find an SQL reference when I open the Doc Library. Is there a way to access this info within the workbench, I'd prefer not to have to open a browser to access reference info on the web.
I have several different tables, but they all have 2 columns that are the same name. I want to write a stored procedure that searches one column in all of the tables and returns the result. Ideas? I'm fairly nub when it comes to SQL.
Following is my SQL fiddle:
http://sqlfiddle.com/#!2/f9bae/1
In which i am trying to check if the whole name is being verified by lookup table or not and if there is any error then it should get replaced by the correct value but the problem i am facing is that if any name contains more than one wrong values then query only update one part of that name and leave the rest unchanged , kindly let me know how can i modify my query for update so it'll update the whole name as per lookup table correct values.
Thanks,
Hi, I am using the following MS SQL statement to insert records and return the unique auto-inc ID value all in one shot. Wonder if there is a simpler/faster/better way to do it?
SET NOCOUNT ON;
DECLARE @res table (ID bigint);
INSERT INTO [Titles] ([Name],[Timestamp],[Title])
OUTPUT INSERTED.ID INTO @res
VALUES ('Name','23 aug 2010','this is a title');
SELECT [ID] FROM @res;
I have one table bbc(country, region, area, population, gdp).
I want to select the regions with a total population of at least 100 million. How can I do it with SQL?
ok, my Sql Server Management Studio Object Explorer had dissapeared. I know the shortcut F8, and the view-object explorer method.. neither do anything, ive clicked everything on the keyboard, googled around, but nothing..
really need this back, its a massive hassle having to navigate through the summary window without the object explorer tree view!
help meeeee...
Before going into production, our client demands actual numbers of how many users our web application can handle.
We have all kinds of features implemented including asset management (file uploads/downloads), documents import/export, various statistics, web-services etc.
Which tool (or set of tools) could do this?
Application details:
XHTML/jQuery
Coldfusion 8
SQL Server 2008
Windows Server 2008
Hi All,
How can we set permissions for users to only allow them to download SSIS packages from the production server and but deny them permissions to run any package in the Server.
http://msdn.microsoft.com/en-us/library/ms141053(SQL.90).aspx
If i assign users to any of the DB roles db_dtsadmin, db_dtsltduser, and db_dtsoperator they will automatically have permission to run the package.
Appreciate your inputs.
Thanks!
In what cases would a call to java.sql.ResultSetMetaData.isSearchable(int col) return false for an Oracle database? The documentation for the method doesn't really answer the question:
"Indicates whether the designated column can be used in a where clause."
I can think of only one case - when the column is the result of an aggregate function (in which case it would have to be part of a HAVING filter, not a WHERE filter).
Are there any other cases?
Hello all,
I am just reading this article and I came across this:
Filter: Remove any functions in the
WHERE clause, don't include views in
your Transact-SQL code, may need
additional indexes.
If I do not use views, what are the alternatives? I mean, in my situation, I want to select some data from a table and then use a few other select queries to work on the subset of data from the first select query?
How can I do this efficiently?
Thanks all
Hi
We've noticed something odd with our Coldfusion 8 client variables DB. We have many more (about 3 times as many) CGlobal entries as we have CData entries.
I would have assumed that the relationship would be 1:1 on the cfid column.
Has any one else noticed this before? I have ruled out old data, my sample is less than 3 hours old. We're using SQL Server 2000 to host the tables.
Thanks in advance,
Ciaran
I have a table Course and every Course has many Resources.
Course
==========
course_id
Resource
==========
course_id
number
I want something like a seperate autoincrement for each course_id. Or, in other words, I want to auto-enumerate the resources for a given course. For example, the resource table could look something like:
course_id | number
==================
1 | 1
1 | 2
2 | 1
1 | 3
1 | 4
2 | 2
2 | 3
and so on.
I want to do this in SQL, using IBM DB2.
Can someone point me towards a resource or show me an example of a good way of writing sql statements in php.
Most statements seem so ugly and unreadable.
I have a SSIS package that I plan to deploy on my SQL Server 2008 machine.
I need to call this SSIS package remotely and synchronously from .NET. Obviously I need to pass parameters to this package as well.
How could I do that?
Thanks,
Alex
I have a SQL query in which I am passing sysdate to the query problem is that when there is no matching date in table with sysdate then it don't shows the zero even if there is nvl applied
here is my query
select * from molasses
where trunc(trn_dte) = trunc(sysdate)
But it show data only when current date is present in table but I want to show zero if no data found in table.please help me to do this in oracle 10 g. Because some times the situation is like above and I have to display zero when no data found
If I have a Parent and Child table in MySQL related by a foreign key, is it possible using a SQL statement to move certain rows from Parent and the related rows from Child into archive tables (e.g. Parent_Archive and Child_Archive) in an atomic manner?
Lets say there is some code that executes the following SQL query:
set rowcount n
But n is unknown. Is there any way to know what n was? I'm using Sybase.