sql

SQL Server: String Manipulation, Unpivoting

I have a column called body, which contains body content for our CMS. The data looks like: ...{cloak:id=1.1.1}...{cloak}...{cloak:id=1.1.2}...{cloak}...{cloak:id=1.1.3}...{cloak}... A moderately tweaked for readability example: ## h5. A formal process for approving and testing all external network connections and changes to the f...

Sum of XML duration elements in SQL2008

I have a XML column that holds information about my games. Here's a sample of the information looks like. <game xmlns="http://my.name.space" > <move> <player>PlayerA</player> <start movetype="Move">EE5</start> <end movetype="Move">DF6</end> <movetime>PT1S</movetime> </move> <move> <player>PlayerB</player> <start ...

Is there an extensible SQL like query language that is safe for exposing via a public API?

I want to expose some spatial (and a few non-spatial) datasets via a public API. The backend store will either be PostgreSQL/PostGIS, sqlite/spatialite, or CouchDB/GeoCouch. My goal is to find a some, preferably standard, way to allow people to make complex spatial queries against the data. I would like it to be a simple GET based re...

SQL one table aggregation

For the last few days I have been attempting to find a method to pull a very important set of information from a table that contains what I call daily counts. I have a table that is setup as follows. person|company|prod1|prod2|prod3|gen_date Each company has more than one person, and each person can have different combinations of prod...

Using OLEDB parameters in .NET when connecting to an AS400/DB2

I have been pulling my hair out trying to figure out what I can't get parameters to work in my query. I have the code written in VB.NET trying to do a query to an AS/400. I have IBM Access for Windows installed and I am able to get queries to work, just not with parameters. Any time I include a parameter in my query (ex. @MyParm) it does...

Asp.net mvc - trying to display images pulled from db \

//Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<%= ...

Python: Number of rows affected by cursor.execute("SELECT ...)

How can I access the number of rows affected by: cursor.execute("SELECT COUNT(*) from result where server_state='2' AND name LIKE '"+digest+"_"+charset+"_%'") ...

What's an efficient way to convert month and year string to a date?

I have column with varchar values like "022008" that I need to convert into a datetime like "02/01/2008". This will run on millions of records for a conversion process. What is an efficient select statement for doing this? ...

MySQL: Count rows by field

All rows in a table have a type field which is either 0 or 1. I need to count rows with 0 and with 1 in one query. So that result should look something like: type0 | type1 ------+------ 1234 | 4211 How can this be implemented? ...

How do I use custom member properties for people on my .NET website

I am trying to make an asp.net website using Visual web dev and C# that accesses data in an SQL database. For my site, I need to be able to save and access additional user properties such as age and gender. I have been playing around with the built in .NET Login tools but I don't understand how to keep track of the additional propertie...

Which data type saves more space TINYTEXT or VARCHAR for variable data length in MySQL?

I need to store a data into MySQL. Its length is not fixed, it could be 255 or 2 characters long. Should I use TINYTEXT or VARCHAR in order to save space (speed is irrelevant)? ...

Complex SQL query... names of returned variables

Excuse me for what I'm sure is an elementary question for most of you, but I have an issue with table columns from separate tables having the same name as one another, and trying to select from both tables in the same query. Okay, so this is my code: $q_value = $mdb2->quote($_POST['query']); $field = $_POST['field']; $sql = "SELECT m.*...

something about sql-dump

hi, guys, i know that sql dump is a series of insert sql statement which reflects all the records inside the database. but may i know what is it used for? why should we dump the database records? is every database supports dumping function? Any additional background information is welcomed! Thanks in advance! ...

What does double "at" (@) marks mean in this MySQL query?

I couldn't find anything about this in MySQL documentation. SELECT accesion_id, definition FROM accesion_table WHERE search_word @@ ? OFFSET ? LIMIT Const.MAX_DISP_COUNT; ...

Like operator in sql server

I want to get all the record from the one table which contain atleast one word from the input string. Ex: input parameter='Stack over flow': select * from sample where name like '%stack%' or name like '%over%' or name like '%flow%' I want to search record which contains 'stack' or ' over' or 'flow' ... ...

Sql Server - INSERT INTO SELECT to avoid duplicates

I have following two tables:- Table1 ------------- ID Name 1 A 2 B 3 C Table2 -------- ID Name 1 Z I need to insert data from Table1 to Table2 and I can use following sytax for the same:- INSERT INTO Table2(Id, Name) SELECT Id, Name FROM Table1 However, In my case duplicate Ids might exist in Table2 (In my case Its Just "1") ...

How to sort a gridview once a radio button is selected

I'm trying to sort records in the gridview right after a radio button is selected. My approach is with the dataview, but because the dataset variable doesn't survive a round trip to the server, I don't know how to make this happen. please help! Public Sub GetCustomers() db.RunProcedure("usp_customers_get_all") db.doSort...

how to take a backup from server database ?

I have connected to local and server database from local SqlServer 2005. How to take a backup from server database ? Regards, kumar ...

Is there a tool which can extract all SQL command strings from Delphi form files?

For documentation and further inspection, I would like to run an 'extract strings' on all DFM files in many projects to find all SQL statements. Are there command line tools which can do this? The DFM files are all in text format. ...

PostgreSQL: Full Text Search - How to search partial words ?

Hello, Following a question posted here about how I can increase the speed on one of my SQL Search methods, I was advised to update my table to make use of Full Text Search. This is what I have now done, using Gist indexes to make searching faster. On some of the "plain" queries I have noticed a marked increase which I am very happy abo...