sql

PHP pagination problem, gives blank page

Below is a code for my pagination. The problem that I am having is that the page count is displayed correctly but when I click on page 2 onwards I just get a blank page. <?php if (isset($_POST['edit'])) { if (empty($_GET['page'])) { $page=0; } else {$page = (int)$_GET['page'...

PROBLEM EXECUTING a query in vb

I have a problem with a sql query. Through the query I am trying to search database for any occurrences of string (can be anything) in a column using the SQL LIKE command. The problem is that it works fine for most of the strings say john, jim, ji"m , but does not work when i include the following characters which are ( ' , { , } , and a...

PSQL row update using NEW statment

Hello, since it is possible to do: INSERT INTO some_table VALUES (NEW.*) in pl/pgsql can we do something similar but for UPDATE clause using NEW ? I mean i want to update some row using values from NEW object. Thanks in advance. ...

Isolated committing of transaction in SQL

I have a n-tier C# ASP .Net application server which uses stored procedures to communicate with the database. I have a service layer which rolls back all ADO .net transactions if an exception is thrown, using TransactionScope.requiresNew. In my stored procedure, I want to track login attempt numbers, so we want to keep the transaction...

GUID in databases other than SQL Server

Question: I'm planning the database for one of my programs at the moment. I intend to use ASP.NET MVC for the user backend, the database being on Linux and/or on Windows. Now, even if I would only make it for windows, I had to take into account, that different customers use different database systems. Now, I figured I use nHibernate, t...

SQL Server: How to open .PRC files?

I have old .prc files (SQL Server Stored Procedures) which have exported from SQL Server 2000. Now when I try to open a .prc file using SSMS 2008, I get a bunch of chinese characters and other odd characters. I tried a solution found here, but it did not help. ...

How Can I Sort A 'Version Number' Column Generically Using a SQL Server Query

I wonder if the SQL geniuses amongst us could lend me a helping hand. I have a column VersionNo in a table Versions that contains 'version number' values like VersionNo --------- 1.2.3.1 1.10.3.1 1.4.7.2 etc. I am looking to sort this, but unfortunately, when I do a standard order by, it is treated as a string, so the order comes ou...

How to get a QModelIndex from another QSqlQuery used for searching the database (needed for selecting the found items)

Hi there, I have a problem when dealing with my QSqlQueryModel. I want to search the database for some items and select them in my QTableView with QItemSelectionModel which needs a QModelIndex. What I don't understand is how should I search in order to get the corresponding QModelIndex for my model/view architecture. I can't possibly u...

Updating one column with other's value in same table

Please consider this sql statements Create table abc (A int, B int ) insert into abc values (1,2) Both of the below statements do the same thing. Why? update abc set A = B, B =0 where A=1 and update abc set B =0, A = B where A=1 I was thinking that in the later statement B columns value is set first and then A columns' value...

Dynamic tags generation from sql server database using full text search

Hi, Is there any solution to generate list of tags (common phrases/words) from sql server full text index. I store some data in xml data type column. I would like to generate common words from that column (performance is on the first place). data changes frequently. ...

SQL right join, force return only one value from right hand side

table 1 --- id , name table2 --- id , activity, datefield table1 'right join' table2 will return more than 1 results from right table (table2) . how to make it return only "1" result from table2 with the highest date ...

can u plz tel how to retrive values from sql 2000 to asp page by stored procedure

how to retrive values from sql 2000 to asp page by stored procedure ...

How do I create a third table from two tables?

I have two great tables that I would like to use as foundation for an even greater third table! The output depends on date interval, like 09/01/2010 - 09/03/2010 Example of Output from TABLE A - - (ALLOCATED Testers) Date Country Allocated testers 09/01/2010 Nigeria 0 09/02/2010 Nigeria ...

wordpress query trouble

EDIT: heres my file thats running the query maby its something else acting up - http://pastebin.com/4Cw3xMEM this works as a direct query in SQLyog SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_type = 'post' AND YEAR(post_date)=2010 ORDER BY post_date DESC; it returns the three posts which are from 2010 but when i...

How do I "Declare the scalar variable" in a VIEW in Sql Server (2005)

I´m trying to create a VIEW in SQL Server 2005. The SQL code is working as such (I´m using it in VS2008), but in SQL Server I´m unable to save it, as error message "Declare the scalar variable @StartDate" and "Declare the scalar variable @EndDate" pops up. Here is the code: WITH Calendar AS (SELECT CAST(@StartDate AS datetime) AS ...

SQL Server: help with a simple stored procedure?

I'm trying to create a simple stored procedure which I can use to write data to a log table. I'm a noob in stored procedures, so what I'm missing here? I get an error saying: Msg 201, Level 16, State 4, Procedure toLog, Line 0 Procedure or function 'toLog' expects parameter '@messageTime', which was not supplied. How to modify this co...

MySQL - Show All Permutations?

Table1: Id MyFK f_name l_name =========================== 1 100 John Doe 2 100 Little Timmy Table2: Id MyFK item price =========================== 1 100 Car 200 2 100 Bike 100 In MySQL, how do I produce a table like this: Id MyFK f_name l_name item price ================...

What's the point of writing a dynamic query in a stored procedure.

If we need some information that can be achieved only through dynamic query then should not it be written in the application code directly (in DAL) rather than in the stored procedure? Because the benefit we achieve from SP is already lost if we use dynamic query in it which is the already saved execution execution plan along with it. ...

Storing Contents from database in c# control

hi, i have a function called ViewComments() which retrieve contents from database using SQL commands private void ViewComments() { hookUp = new SqlConnection("Server=XXXX\\SQLEXPRESS;Database=WebExcerciseDB;" + "Integrated Security=True"); SqlCmd = new SqlCommand("SELECT PersonName,PersonMail,Commen...

How to delete row if the previous have the same value in specific a column

Let's say I have a table that looks something like this: ------------------------------- id|column2|column3 |column4 ------------------------------- 1 value1 somevalue somevalue 2 value2 somevalue somevalue 3 value2 somevalue somevalue <----- I want this column deleted 4 value3 somevalue somevalue As you can see I want t...