sql

mark rows as deleted or updated befor loading them in a dataset

Hello, I'm developping a sync solution enables filtering but is there any way to load the changes form the source database into a dataset and mark the deleted or updated rows to transfer this dataset to client and update its data? thanks. ...

LINQ and SQL performance issue when working with Membership

I am using ASPNET membership with 50000 records, and we have another table called "scm_Users" which has exactly number of records, they are NOT linked by any key. I have a simple SQL: select * from dbo.aspnet_Users a, dbo.scm_Users b where a.UserName = b.UserName I can get 50000 records in less than 1 second. In LINQ, (using Entity F...

slow SQL command

I need to take some data from one table (and expand some XML on the way) and put it in another table. As the source table can have thousands or records which caused a timeout I decided to do it in batches of 100 records. The code is run on a schedule so doing it in batches works ok for the customer. If I have say 200 records in the sourc...

C# HTML tags inside GridView

I have a SharePoint web part that I wrote in C# which is used to display SQL Server data based on user selections. I pull the data with a DataReader, fill a DataSet with it, and set that DataSet as the DataSource in a GridView and add that control to my page: GridView outputGrid = new GridView(); outputGrid.CssClass = "OutputGrid"; outp...

MySQL - connection and security

Hi, I was wondering if someone could tell me if there is any potential security breeches that could occur by connecting to a sql database that does not reside at 'localhost' i.e. via ip address? Regards, Phil ...

How to save an order (permutation) in an sql db

I have a tree structure in an sql table like so: CREATE TABLE containers ( container_id serial NOT NULL PRIMARY KEY, parent integer REFERENCES containers (container_id)) Now i want to define an ordering between nodes with the same parent. I Have thought of adding a node_index column, to ORDER BY, but that seem suboptimal, since that...

PHP Error - Login Script

I am creating a new login script/members directory. I am creating it from scratch without any frameworks (advice on this matter would also be appreciated). The situation: // Look up the username and password in the database $query = "SELECT admin_id, username FROM admin WHERE adminname = '$admin_user' AND password = SHA1('$admin_p...

SQL: how to get the left 3 numbers from an int

I want to retrieve the left 3 numbers from an integer to be stored in a table. For example, if the int is 1234567, I want to retrieve 123. I want the second number (123) to also be an int; I don't want to convert anything to a string. (And yes, really I should be working with strings. But I don't have control over that aspect of the iss...

SQL group results as a column array

Hi guys, this is an SQL question and don't know which type of JOIN, GROUP BY etc. to use, it is for a chat program where messages are related to rooms and each day in a room is linked to a transcript etc. Basically, when outputting my transcripts, I need to show which users have chatted on that transcript. At the moment I link them thro...

multiple search fields

What will be the best approach if I have search fields for 20 or more and any combination should be valid. Is there any special way to do it in openJPA or native SQL is better. Any idea would be helpful.Thanks. ...

Oracle Unique Indexes

I was creating a new table today in 10g when I noticed an interesting behavior. Here is an example of what I did: CREATE TABLE test_table ( field_1 INTEGER PRIMARY KEY ); Oracle will by default, create a non-null unique index for the primary key. I double checked this. After a quick check, I find a unique index name SYS_C0065645. ...

Joining two similar tables in MySQL

Hello, I have two tables with similar columns - let's say table A with column LABEL_A and table B with column LABEL_B. The data types of LABEL_A and LABEL_B are same. How can I select LABELs from both tables in a single query? (So the the result of the query contains single column LABEL containing data from LABEL columns of both tables...

Is there is something like stored procedures in NOSQL databases?

I am new to NOSQL world and still comparing between nosql and sql databases, I Just tried making few samples using mongodb. I am asking about stored procedures when we send few parameters to one stored procedure and this procedure execute number of other stored procedures in the database, will get data from stored procedures and send ...

Oracle index is defined identically to constraint

I am having an issue with Oracle SQL Developer where it keeps telling me my index "Index PK_TBLCASENOTE is defined identically to constraint PK_TBLCASENOTES" whenever I go to the Indexes section of my table TBLCASENOTE. I found this Oracle form post but no one seems to have a solution. This is the DDL for making the table. CREATE TABL...

Is there a way to delay compilation of a stored procedure's execution plan?

(At first glance this may look like a duplicate of http://stackoverflow.com/questions/421275 or http://stackoverflow.com/questions/414336, but my actual question is a bit different) Alright, this one's had me stumped for a few hours. My example here is ridiculously abstracted, so I doubt it will be possible to recreate locally, but it p...

Combining MDX and SQL datasets into one for a drill-through report??

Hello, Wondering if I could get some advice and direction on this following requirement: Need to Create a SSRS report with two datasets, one MDX and one SQL. I then need to join those two datasets to create a third dataset which is to be used by a drill though report. How can I combine those datasets into one and use that as a Dataset...

Database Projects: Visual Studio 2008 vs 2010

I just installed VS 2010 for the purposes of running someone else's DB project that was created using the 2010. In VS 2008 I was able to right click on a SQL file ans select "Run ON" to run the script on a given SQL Server. I don't see this option in 2010. Is it available and if so how do I get access to it? ...

SQLCMD Mode - Incorrect Syntax?

Trying to use: :On Error exit :r D:\opt\db_objects\REPORTS\dbo.sp_ReportCountLORUsers.sql ...and I get: Msg 102, Level 15, State 1, Line 5 Incorrect syntax near 'U'. ** An error was encountered during execution of batch. Exiting. What am I missing? ...

MySQL Delete from 1 table, using multiple tables

I would like to delete all the rows found by that query: SELECT cart_abandon.* FROM cart_abandon, cart_product, txn_product, users WHERE cart_abandon.cartid = cart_product.cartid AND cart_product.productid = txn_product.productid AND txn_product.username = users.username AND users.id = cart_abandon.userid AND txn_product.txndate >= cart...

Is this query safe in SQL Server?

I have this SQL update query: UPDATE table1 SET table1.field1 = 1 WHERE table1.id NOT IN (SELECT table2.table1id FROM table2); Other portions of the application can add records to table2 which use the field table1id to reference table1. The goal here is to remove records from table1 which aren't referenced by table2. Does SQL Serv...