After much research I am a little confused by which identity tracker I should use in sql.
From what I understand scope_identity will give me the last id updated from any table and ident_current will will return the last id from a specified table.
So given that information it would seem to me the best version to use (if you know which ...
When developing an application with lots of stored procedures, should you store them in some sort of source versioning system (such as source-safe, TFS, SVN)? If so, why? And is there a convenient front end way to do this with SQL Server Management Studio?
...
I'm using reporting services to make a report graph. However my data looks like this:
Table1
C01 C02 C03 C04
1 2 3 4
I need to do a sql query to return data that looks like this:
Any_Col_name
1
2
3
4
I'm using MS Reporting Services with a Oracle DB. I cannot restructure the table.
...
I'd like to be able to take a ref cursor and transform it by selecting from it into another ref cursor. For example, something like this:
begin
declare c_cur sys_refcursor;
c_cur2 sys_refcursor;
open c_cur for
select 1 from dual;
open c_cur2 for
select 1
from c_cur
where 1 = 2;
end;
/
Is it possible in Oracle to...
Hey everyone,
I am trying to run a simple SQL statement with DB2 and am having a few problems.
I would like to have a single script in a txt/db2 file and have the engine process all of the commands
Here is the script:
CONNECT TO MYDB
CREATE TABLE PERSONS(
PID SMALLINT NOT NULL,
NAME VARCHAR(20) NOT NULL
)
TERMINATE
When ...
hey all,
i'd appreciate some help putting together a sql script to copy data from one table to another. essentially what i need to do for each row in the source table is aggregate the column values and store them into a single column in the target table.
TableA: ID, ColumnA, ColumnB, ColumnC
TableB: Identity, ColumnX
so, ColumnX nee...
I am trying to write a custom code generator that can parse stored procedures. I wrote a few regex, but they don't seem to work all the time. I do have access to the database; does a system query exist that will return the required parameters and possible return values? I have played around with sp_depends, but it does not seem to includ...
According to the user's input I want to select the record from the database. This is my code:
<%
String jempid=request.getParameter("empid");
out.println(jempid);
int intempid=1223;
Connection conn=null;
String url="jdbc:mysql://localhost/employees";
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection...
HI All,
I've succesfully synchronized both source and local db using the local database cache item in VS 2008.
However, I need to access the SQL CE db directly from within another dll/process, and not using a dataset. Reason being my business object code does not use datasets. code would look something like this:
Dim conn As New SqlS...
Hello!
I woud like to save my MS SQL Server 2005 stored procedures to .sql files automatically (would prefer a tool which I can call via .bat) so I dont have to click each single sproc manually and save it.
I have already found SMOscript from devio IT, but it gathers all tables and sproc which takes some time. Is there any similar tool ...
In my research to find a way to make PHP tell me how many people are 'online' on my site I've discovered that there are ways to 'estimate' this.
I've chosen to log everything that happens on the site, also for error-management sake, but now i'm stuck at writing my SQL query.
Basicly I have a database with 'IP', 'userid' and 'datetime'...
At the moment, I apply a 'throw everything at the wall and see what sticks' method of stopping the aforementioned issues. Below is the function I have cobbled together:
function madSafety($string)
{
$string = mysql_real_escape_string($string);
$string = stripslashes($string);
$string = strip_tags($string);
return $string;
}
However,...
I have a really weird issue with an SQL query I've been working with for some time. I'm using SQL Server 2005.
Here's an example table from which the query is made:
Log:
Log_ID | FB_ID | Date | Log_Name | Log_Type
7 | 4 | 2007/11/8 | Nina | Critical
6 | 4 | 2007/11/6 | John | Critical
5 | 4 |...
i was hoping to be able to do something like this:
declare @label varchar
set @label = 'label_1'
goto @label
label_1:
label_2:
of course, sql server gives me an incorrect syntax error... so i was wondering if i can still do this with a slightly different syntax?
...
This small SQL error is bugging me. It doesn't seem to be a problem with the query, just the scope(?), examples work best:
SELECT ocp.*, oc.*, GROUP_CONCAT( u.username SEPARATOR ', ') AS `memjoined`
FROM gangs_ocs_process ocp, gangs_ocs oc
LEFT JOIN users u ON u.userid IN ( ocp.membersin )
WHERE ocp.ocid =1 AND ocp.gangid =1 AND oc.oc_n...
We currently have a system where each client gets their own database when they sign-up. Not surprisingly this is getting out of hand.
We are preparing merge all these databases together to a single db. In order to do this we need to note which organization the row belongs. How best is this handled on the database and what pros/cons (...
Difficult to put down in words, so assuming this example table:
| id | col1 | col2 |
--------------------
| 1 | aa | 12 |
| 2 | aa | 12 |
| 3 | bb | 13 |
| 4 | cc | 13 |
I would like a query which selects rows 3 & 4 or even just the value 13
So something like checking this assumption: "all values of col2 which a...
Assuming the following data:
Column1 (data type: varchar(50))
--------
11.6
-1
1,000
10"
Non-Numeric String
I have a query,which is pulling data from this column and would like to determine if the value is a number, then return it as such in my query. So I am doing the following
SELECT CASE WHEN IsNumeric(Replace(Column1,'"','')...
Consider the following function arguments (they are already extracted of the function):
Monkey,"Blue Monkey", "Red, blue and \"Green'", 'Red, blue and "Green\''
Is there a way to extract arguments to get the following array ouput using regexp and stripping white spaces:
[Monkey, "Blue Monkey", "Red, blue and \"Green'", 'Red, blue an...
We maintain a set of change scripts that must be run on the DB when our web application is released. We waste a lot of time and experience some difficultly keeping these updated however, our DBA likes to (rightly) tweak stored procedures and schemas on the live system to maintain system performance.
Every so often we have to rebase our...