sql

Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server '\\.\pipe\3F103E6E-3FD4-47\tsql\query'

Hi, I'm gonna get a backup with below method : void BackupDatabase(string sConnect, string dbName, string backUpPath) { using (SqlConnection cnn = new SqlConnection(sConnect)) { cnn.Open(); dbName = cnn.Database.ToString(); ServerConnection sc = new ServerConnection(cnn); Server sv = new Server(s...

got stuck on using prepare() and bindvalue() in c++ QT

hi , I've written a SQL query based on QT assisstant and it says that you can use the prepare() method instead of exec() then you can pass your parameter by the help of two methods called : bindvalue() and addbindvalue() here is an snippet code of my problem : Query->prepare("SELECT ID , Row , Col FROM sometable WHERE Row = :row AND Co...

SQL WHEREing on a different table's COUNT

So, I want to apply a WHERE condition to a field assigned by a COUNT() AS clause. My query currently looks like this: SELECT new_tags.tag_id , new_tags.tag_name , new_tags.tag_description , COUNT(DISTINCT new_tags_entries.entry_id) AS entry_count FROM (new_tags) JOIN new_tags_entries ON new_tags_entries.tag_id = n...

PHP PunBB How to have the most recent posts of the forum on the home page?

I want to display the most recent posts in a punbb forum on the website home page, does anyone have the php code for this? ...

Diffrence between getting information from database about OneToMany and ManyToMany Relationships

Hello, everyone I'm currently working a relationship Tree for a given GUID. i'm working on Dynamic CRM 4, C# and a SQL 2005 database. i have done the mapping, but one of the requirments is that near the name of each related entity, i will also add the description of the relation as defined in the CRM. since the description name cannot ...

MySQL SQL getting most recent records in a table?

I have an sql statement as below attempting to retrieve the most recent entries in a table. So I have two questions: is it better to order by id or by date? how do I rewrite this sql statement to re-order by date? SELECT id, comment, DATE_FORMAT(entry_date, '%W %H:%i') FROM comments ORDER BY id DESC LIMIT 10 ...

MySQL/SQL retrieve first 40 characters of a text field?

How can I retrieve a text field from mysql db table, but not the entire text, just the few 40 or so characters. Can this be done in sql or do I need to do it using php? basically what I am trying to do is show the first x characters and then let the user click on that to view the full content. ...

Intelligent Database - Capable of identifying out of the ordinary values

I am looking for a tool or system to take a look at the database and identify values that are out of the ordinary. I don't need anything to do real time checks, just a system which does processing overnight or at scheduled points. I am looking for a system at two levels: Database wide: Eg: Compare salaries of all employees and identify...

Open File Stream Win API

I'm trying to use the OpenSqlFilestream Instruction but my code did not recognise it What dll i have to load in order to use it? ...

ACCESS DENIED error from stream file open

Possible Duplicate: Access Denied in SQL 2008 EXPRESS I have create my code in order to write images in a remote sql server All the details of accessing and writing are fine until now, including the system account right now i'm in the command of: SqlFileStream = New SqlFileStream(filePathName, fileToken, FileAccess.Write) an...

SQL 2008 create table method and KEY...

Hi again, I've got a script that generates a table - only my version of SQL 2008 throws up an error - has the syntax changed? Or how do I fix it manually? CREATE TABLE ScoHistory ( CourseID varchar (255) NOT NULL , SessionID int NOT NULL , ScoID varchar (255) NOT NULL , StudentID varchar (255) NOT NULL , DateRecorde...

Please suggest how to achieve this with joins

I need to write queries to find out new users and regular users. new users are the ones whose uuid appeared in last 24 hours (from now minus the time query is fired) in table2 and was not there before. regular users are the ones whose uuid appeared in last day in table2 and was also there at least once in the last 3 days. In addition ...

SQL Server 2005 Asnyc stored procedure

Hi all, I am currently having problems calling a stored procedure async from within a insert-update-trigger. For this I m using the service broker. --message type CREATE MESSAGE TYPE [TheMessage] VALIDATION = NONE --contract CREATE CONTRACT [TheContract] ([TheMessage] SENT BY ANY); --queue CREATE QUEUE [TheQueue] WITH ACTIVATION (STA...

how to select distinct and concatenate in sql

Lets say we have a following table with two columns and following rows of data in SQLServer-2005: Tiger 50 Wolf 4 Tiger 53 Lion 55 Elephant 54 Rhino 52 Lion 5 Can we have a sql query that result as following: Tiger,Wolf,Lion,Elephant,Rhino as a single string varchar output?Is it possible ? using T-SQL not possibl...

Send a file to a PHP script from a VB.NET app

I need to send some data from a SQL DB Server on an internal network to an external web server. I was hoping to accomplish this by writing a VB.NET app that is invoked once per day that sends about 1 MB of data to a PHP script on the web server, where it is deposited in a database. What is a good method to send data to a PHP script fro...

Update table ID from like value in another table with SQL 2008

I have a table where I am capturing referal links. I have another table that contains the host name when a referal link is inserted (Duplicates are not allowed in the host table. So if it already exists the ID is pulled from the referal host table). HEre are the table structures: Referal Table: referalTableID referalLink referalHostID (...

Calculation of time differences with overlapping -- only working with temporary table

Below is a working SQL query for calculation of time differences with overlapping. For certain reasons I need to create a view - therefore I cannot use the temporary table ALMDB. Instead the view begins with SELECT X.Alarmgroup and I have to use the already created view QV_Alarms. But in this case the output is different to the version w...

Time range with overlapping --- without temporary table result is OK otherwise wrong

Below is a working SQL query for calculation of time differences with overlapping. For certain reasons I need to create a view - therefore I cannot use the temporary table TempALMDB. Instead the view begins with SELECT X.Alarmgroup and I have to use the already created view QV_Alarms . But in this case the output is different to the vers...

How to retrieve last autoincremented value in MS-Access like @@Identity in Sql Server

I want to retrieve identity column value in ms access from an autoincremented column. Basically i m running a transaction in which i have to write two insert queries. 2nd query will be containing autoincremented value that was generated from query 1. how can i do that ? ...

SQL for price difference calculation

I've got two tables that I'm trying to grab data from. The first is a 'titles' table, which represents product information (name, unique ID, etc). The second is a 'prices' table which collects price information for various currencies (each product can have multiple historic entries in the prices table). I've written a fairly long-winde...