Hi all.
I want to select at least 20 records from a table into a new table based on a number 1 to 20.
select * into blah from foo where fubar = '1'
how do i add 1 to 20 into that statement?
edit:
select * into blah from foo where fubar = '1' and where fubar = '2' and where fubar = '3'
Sorry. Let me see if i can make it more cle...
I have a stored procedure for select data between many different sql server, and all the sql server have set the link server at the sql server where the stored procedure built in.
Here is my procedure:
Create Proc dbo.spGetData
@code as char(4)
AS
if (@code='aaaa')
Select date From [ServerA].Stock.dbo.Syspara
else if (@code='bbbb')
...
JavaScript takes a string of 4 hyphen delimited id's and string of 4 hyphen delimited titles and makes a request for JSON data to my C# web service. Then the C# web service makes a tracker with status "pending" and awaits the user to confirm the tracker before json can be served up on next request.
When the user confirms the tracker th...
Do you know of any good online SQL Reference for DB2. I need it for someone who will be moving from Oracle to DB2
...
Where is the function sysdate stored, and in what package, e.g:
select sysdate from dual;
select systimestamp from dual;
Also, take this query:
select sys.login_user,sys.database_name ,sys.sysevent from dual;
what is sys here?
Is it a package?
where is this package stored?
can I view the source(text) in this package please provide...
Is it possible to find out runtime using t-sql if a type (e.g. nvarchar or int) is fixed-length or not by querying some system-table?
The reason I need to do this is that I need to generate sql-code runtime and need to generate some declarations (DECLARE @foo SOMETYPE(LENGTH) or DECLARE @foo SOMETYPE) depending on the type of some colum...
I need to dynamically construct a set of JOIN statements where the table and column names are passed in from another ColdFusion query. When passing the string values to into the statement, CFQUERYPARAM adds single quotes around it - that's part of the point of CFQUERYPARAM. Given that this breaks the SQL statement, is it acceptable not...
An SQL database is overkill if your storage needs are small. When I was young and dumb, I used a text file and flock()ed it when I needed to access it. This doesn't scale, but I still feel that non-database solutions have been completely ignored in Web 2.0.
Does anyone not use an SQL database for storage? What are the alternatives?
...
I am getting an error in NetBeans saying I must throw an SQLException in this method:
private void displayCustomerInfo(java.awt.event.ActionEvent evt)
{
int custID = Integer.parseInt(customerID.getText());
String info = getCustomerInfo(custID);
re...
I have a semi-complicated stored proceedure that I need to create. I'm not exactly a DBA here but no one else in my company is better than I am. The basic idea is I have a group of tasks. The user completes these tasks and gets a flag for each task completed. To be considered "complete" the user has to have all of a group of given tasks ...
I'm currently using ibatis to returns some pojos and everything works great.
My question is:
I have to return 1 row from a table, just like 3 fields, and I don't want to create a pojo for it. I just want to run the query and get the 3 values. Is there any easy way to do this without create a special java object just for this?
...
Hi,
I have a series of DML and DDL(Drop View only) statements that I need to execute under single transaction from VB.net app. I m using commandObj, and kept above all I kept beginTransaction statement. Everything is working fine expect when error is returned by Drop statement. If Drop statement returns error then whole transaction is r...
declare @test varchar(20)
set @test = 'VALUE'
exec('
select '+@test+'
')
This returns:
Invalid column name 'VALUE'.
Is there an alternate method to display the variable value on the select statement?
...
Hello,
I need SQL to be running on 2 data centers(DC) active/active.
There are tonnes of challanges to be done here and below are my requirements.
Data synchronization must be async. (For higher performance)
I need to be able to read/write on both DC
When Site1 goes down, all the traffic will be routed to Site2 and when Site1 comes ba...
I have a pretty simple SQL query but something is missing and I didn't find an answer for this problem yet.
The thing is that I select some fields with several ids and I want the result to be ordered in this particular order.
The query is the following
SELECT `content`.*
FROM `content`
WHERE (user_id = "1" AND ( id = "4" OR id = "...
It's possible to retrieve a value (stored with spanish characters like 'ñ' or 'á') from any given table without spanish character? i.e:
If I have the value 'Japón' stored, retrive it like 'Japon'.
...
Is there a quick way to prevent insertion of repeated data into a table? I mean, the key will always be different but the rest of the entry could be repeated and by so, there would be 2+ different keys identifying the same data.
I could search the whole table but i am afraid of the performance lost when doing this.
Note: I'm just start...
If I remember correctly, I think Jeff has mentioned in the Stack Overflow podcast a possible weakness in SQL prepared statements. I'm wondering what kind(s) of weakness(es) did he refer to? Was it possibly just about inappropriate usage thereof, or something more sinister?
The podcast, to my remembering, didn't go deeper into the subjec...
Hey all, Ive been tasked to upgrade our existing extranet from .net 2.0 to 3.5.
One of the main issues i had during the build phase for the 2.0v was the data was coming from SQL server 2005 and a legacy db in Sybase 9. To achieve this i basically made to Dataset's accordingly based on SPROCS and a third DS to merge. This then would...
I've never used databases before in my work. I know some basic SQL syntax. Just looking for a decent tutorial that will show me how to set up a database and use it to serve information on an ASP.NET page.
...