sql

Persistent SQL Table lock from C#

I'm trying to create a persistent SQL (SQL Server 2005) lock on a table level. I'm not updating/querying the specified table, but I need to prevent a third party application from updating the locked table as a means to prevent transactions from being posted (the table I wish to lock is the key on their transaction that interferes with my...

What sort of schema can I use to accommodate manual date based data entries?

I have an admin where users from multiple properties can enter in monthly statistics for twitter/facebook followers. We do not have access to the real data/db so this is why a manual entry. The form looks like this: Type ( radio, select **one** only ): - Twitter - Facebook Followers/Fans ( textfield ): Property (dropdown): Hotel A, ...

SQL (server) date conversion

I want to convert the run duration (from msdb..sysjobhistory) to an elapsed seconds figure. The duration is stored as an integer where for example 13 means 13 secs 213 means 2 mins and 13 secs = 133 secs 310213 means 31 hours, 2 mins and 13 secs = 111,733 secs Is there any neat way of doing this? It's SQL Server 2000 but I wo...

SQL Server and Android

Is there any way to connect to a SQL Server from an Android application and execute/query SQL statements without Web Service/WCF etc? Thanks. ...

sequence of events in ACCESS

what is the proper way of doing the following: getting DATE as user input running a query generating a report that uses the query this is the solution i was thinking: have a form that takes user input run the query open the report what is the correct way of doing this>? ...

why was my report sent to the printer?

i have a button and in the click event i have this code: DoCmd.OpenReport "All_Ones" when i click it, for some reason the report starts to print! why is this? ...

help with stored procedure

i am looking at this site: http://cloudexchange.cloudapp.net/stackoverflow/s/84/rising-stars-top-50-users-ordered-on-rep-per-day set nocount on DECLARE @endDate date SELECT @endDate = max(CreationDate) from Posts set nocount off SELECT TOP 50 Id AS [User Link], Reputation, Days, Reputation/Days AS RepPerDays FROM ( SELEC...

String update in SQL Server

Currently I have varchar field. The delimiter is "$P$P$". The delimiter will appear at least once and at most twice in the varchar data. Eg. Sample Heading$P$P$Sample description$P$P$Sample conclusion Sample Heading$P$P$Sample Description If the delimiter appears twice, I need to insert a text before the second occurance of the de...

Automatically Persisting a Complex Java Object

For a project I am working on, I need to persist a number of POJOs to a database. The POJOs class definitions are sometimes highly nested, but they should flatten okay, as the nesting is tree-like and contains no cycles (and the base elements are eventually primitives/Strings). It is preferred that the solution used create one table per ...

Why there is a difference in query results?

SELECT count(*) FROM Table1 t1 SELECT count(*) FROM Table1 t1 Where t1.ID not in (select ID from Table2) SELECT Count(*) FROM Table1 t1 inner join Table2 t2 on t1.ID = t2.ID Results:- 83 62 26 Why there is difference in results of 2nd and 3rd query when total is 83 from Ist Query? Is it not supposed to be either 57 (from 2nd que...

access: displaying data on a report

i have a report that is attached to a query i want to display the contents of a query. there are three columns. i made a list box but it looks weird: i dont want the scroll bars, i just need the three fields from a query to be displayed regularly just as they would be in a spread sheet or grid ...

How to sanitize sql fragment in Rails

I have to sanitize a part of sql query. I can do something like this: class << ActiveRecord::Base public :sanitize_sql end str = ActiveRecord::Base.sanitize_sql(["AND column1 = ?", "two's"], '') But it is not safe because I expose protected method. What is a better way to do it? ...

How to properly group SQL results set?

SQL noob, please bear with me!! I am storing a 3-tuple in a database (x,y, {signal1, signal2,..}). I have a database with tables coordinates (x,y) and another table called signals (signal, coordinate_id, group) which stores the individual signal values. There can be several signals at the same coordinate. The group is just an abitrary...

How to rebuild C# Class from XML

I would like to save an instance of a c#.NET class in SQL for later retrieval. I am able to use LINQ to SQL to add a record complete with all the xml that makes up the class. Now how do I retrieve that xml and reconstruct the class object instance? ...

Where to put conditionals in ANSI-syntax SQL queries

What's the difference between these two queries? I've been resistant to jumping on the ANSI-syntax bandwagon because I have not been able to unravel various syntactical ambiguities. Is 1) returning the product of the join and only then filtering out those joined records which have weight >= 500? And is 2) filtering out those prior to ...

Update table.column with another table.column with common joined column

Hit a speed bump, trying to update some column values in my table from another table. This is what is supposed to happen when everything works Correct all the city, state entries in tblWADonations by creating an update statement that moves the zip city from the joined city/state zip field to the tblWADonations city state TB...

access: centering controls on report

thanks to hansup i have a bunch of fields on a report, i would like to center the enter block of controls. how do i do it? ...

How to filter rows on a complex filter

I have these rows in a table ID Name Price Delivery == ==== ===== ======== 1 apple 1 1 2 apple 3 2 3 apple 6 3 4 apple 9 4 5 orange 4 6 6 orange 5 7 I want to have the price at the third delivery (Delivery=3) or the last price if there's no third delivery. It would...

Run SQL Queries on DataTables, or similar, in .Net, without an RDBMS

I'd like to have a dataset or datatables, and be able to run SQL statements on them, without using any external RDBMS. For Example, to take take 2 datatables in a dataset and just join them outright with a SQL statement and Where clause, the result being a new datatable? For example if I have 2 datatables, named People and Addresses in...

Setting custom SQL in django admin

I'm trying to set up a proxy model in django admin. It will represent a subset of the original model. The code from models.py: class MyManager(models.Manager): def get_query_set(self): return super(MyManager, self).get_query_set().filter(some_column='value') class MyModel(OrigModel): objects = MyManager() class Me...