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.
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?
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.
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!
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.
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.
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!
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
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.)
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 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?
Money, Staff, Skill and preference to open source or commercial is neutral. Lets take the best of the best programmers (for arguments sake) and think about this:
What will perform better overall:
PHP & MySQL
or
ASP.Net & Microsoft SQL
(I don't want biased answers, just
looking for Performance, and Speed).
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.
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?
I am making a windows service to be able to run operations on a sql server database (insert, edit, etc) and invoke Stored Procs.
However, is there a way for me to know the type of the SP? When invoking from C#, I need to knof if it is returning 1 value, or more, or none (so I can use executereader, scalar, etc)?
Thanks
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
Having a bit of difficulty figuring out how to create a named_scope from this SQL query:
select * from foo where id NOT IN (select foo_id from bar) AND foo.category = ? ORDER BY RAND() LIMIT 1;
Category should be variable to change.
What's the most efficient way the named_scope can be written for the problem above?
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...
My database has about 30 views, most of which have a reference to another database on this server (call it DB1).
Now, without going into the reasons why, I need to update all those views to DB2, also on the local server.
I would hate to have to do this manually on each view. Is there some SQL query I can run that will replace all occurrences of the string 'DB1' with 'DB2' in all my views?
Can I have a SQL query to get the data from columna in tableA whose values don't start with 'f' ?
For example:
select * from tableA where columnA
where values don't start with letter 'F'.
I have this sql query:
SELECT
S.SEARCH,
S.STATUS,
C.TITLE AS CategoryName,
E.SEARCH_ENGINES AS Engine,
S.RESULTS,
S.DATE,
S.TOTAL_RESULTS AS Total,
S.ID
FROM
PLD_SEARCHES AS S
Join PLD_CATEGORY AS C ON C.ID = S.CATEGORY_ID
Join PLD_SEARCH_ENGINES AS E ON S.SEARCH_ENGINES_ID = E.ID
ORDER BY S.DATE ASC
I want to identify if S.STATUS is either 1 or 0 and according to those values to return COMPLETE or PENDING in the query results
Hi
I would like to create a temporary table in a Oracle database
something like
Declare table @table (int id)
In SQL server
And than populate it with a select statement
Is it possible?
Thanks
Hi,
I have a sql script file that upon import creates a table in a MySQL database and fills it with 2800 record. These are all the postal codes for the country Belgium.
Now I would like to make a Ruby on Rails database migration file from this. Any idea how I can do this?
Thanks,
Michael
Hi,
I got used to the xml support and recursive common table expressions of sql server 2005. I am just wondering whether any free dbs like mysql support these requirements nowadays? Thanks.
Christian