sql

Making a stored procedure return 5 little data from three different tables.

I'm having trouble with stored procedure here and I'm not sure what to do or how to approach this. I'm sure there's a genius out here that can help me out! :D I want my stored procedure to return Anuncio's idAnuncio, titulo, precio, descripcion, and by using it's foreign keys return Categoria's descripcion and Imagenes's imagen. But ...

Why is are my tables not showing up in SQL Server Management Studio's intellisense?

I can't pull up my tables so I can use them in my stored procedure. Any reason why they aren't showing? ...

DB2 Increment a value by a certain amount

I need to write a query that increments a value in a table by 3 when run. I would like to do something like this but this doesn't work. UPDATE table SET value = (SELECT value FROM table WHERE condition = true) + 3 WHERE condition = true As in the title this is a DB2 database, any ideas? EDIT: Actually this d...

SQL Query returning repeating information

I'm having an issue where this query statement is giving me repeating GoalText in the results. Any ideas? The complete query statement: Select g.GoalText, convert(nvarchar, g.GoalID) + '|' + convert(nvarchar, r.GoalReqID) as GoalID, GoalReqID from Goal g inner join GoalRequirement r on g.GoalID = r.GoalID where GoalReqID in (Select...

What is the Big-O for SQL select ?

What is the Big-O for SQL select, for a table with n rows and for which I want to return m result? And What is the Big-O for an Update, or delete, or Create operation? I am talking about mysql and sqlite in general. ...

Would this work for searching something in my DB?

Create Proc CargarAnuncioPorBusqueda @searchString varchar(max) AS select * from Anuncio where titulo Like '%'+ @searchString + '%' Say the user writes: "pools", would this Stored Procedure return everything that has "pools" in the "titulo"? Thank you. :) ...

SQL INSERT stored procedure not working.

Create Proc CrearNuevoAnuncio @Titulo varchar(250), @Precio int, @Descripcion varchar(250), @IDCategoria int, @IDImagen int, @Login varchar(200) AS INSERT INTO Anuncio VALUES( @Titulo, @Precio, @Descripcion, @IDCategoria, @IDImagen, @Login ) The error is because the table anuncio ...

Choosing the highest scored results from a table variable in SQL

I have the following table variable in SQL Server 2005: DECLARE @results TABLE (id int IDENTITY(1,1), customerId int, salesId int, score int, lastServiceDate datetime, PRIMARY KEY(id)); I need an efficient way to c...

Can you do an inner select with Subsonic?

This is my sql query: subsonic version 2.1.0.0 No Linq (.net 2.0) select ( select Title from MenuTranslation mnu2 where mnu2.languageid = 1 and mnu2.menuelementid = menutranslation.menuelementid )as BaseTitle, * from menutranslation inner join menuelement on menuelement.id = menutranslation.menuelementid where menuelementid in (sel...

How to do this query in T-SQL

I have table with 3 columns A B C. I want to select * from this table, but ordered by a specific ordering of column A. In other words, lets' say column A contains "stack", "over", "flow". I want to select * from this table, and order by column A in this specific ordering: "stack", "flow", "over" - which is neither ascending nor descen...

How do I save a Byte Array to a Database in vb.net

I have a byte array of a file and I need to save it into my database in a field that has been set aside of type image. However I have a problem my data access class takes a sql string and commits it to the database for example. "EXECUTE stored proc @parm1, @parm2, @parm3" However the problem is I cannot figure out how to transfer the ...

Error in SQL "The multi-part identifier "ExternalKeywords.ID" could not be bound."

SELECT * FROM ExternalQuestionKeyword INNER JOIN ExternalKeywords ON ExternalKeywords.ID=ExternalQuestionKeyword.KeywordID WHERE QuestionID = 17 ...

Saving an image to SQL Server 2008?

I have this: Create Proc CrearNuevoImagen @imagen image AS INSERT INTO Imagenes(imagen) VALUES( @imagen ) I see that @imagen is of type 'image'. My question is save that I have an .jpg image, on my front-end (my asp.net website code), how could I convert the .jpg image to fit into the 'image'-type column? Or does...

Multivalued parameter within T-SQL Query

I am working on .aspx page that uses a t-sql query that uses a multivalued input parameter (a set of labnames) using an array that would store all the labnames prior to running the query. I have the following parameters for the query. With c.Parameters .Add(New SqlParameter("@sdate", sdate.text)) .Add(New SqlPar...

How to drop a table in PostgreSQL which includes double quotes in its name

I accidentaly created a table in PostgreSQL which contains, in its name, some double quotes. I used SQL Server 2000 DTS to import data from it to my PostgreSQL server, but while importing, it created the table but with double quotes in it. Actually the table name when I do SELECT * FROM pg_tables is : public","t_freemailer So, when I t...

i have xampp mysql server running, how do i run code?

i need run code that will create a database and populate tables. i am using windows. how can i run this code? localhost/phpmyadmin shows nothing, it's a blank page could it be because i installed the lite version? ...

running sql code with microsoft sql 2008

i have about 8mb of sql code i need to run. it looks like this: /* MySQL Data Transfer Source Host: 10.0.0.5 Source Database: jnetdata Target Host: 10.0.0.5 Target Database: jnetdata Date: 5/26/2009 12:27:33 PM */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for chavrusas -- ---------------------------- ...

Integrated security in connection string.

I just tried to move one of WCF service to windows authentication. using this connection string <add name="MembershipConnection" connectionString="Data Source=DBADDRESS ;Initial Catalog=aspNetMembership;Persist Security Info=True;Integrated Security=SSPI;"/> WCF service is hosted in IIS (2003) and the user I have setup under 'Directory...

running 8mb of sql code in wamp?

i have about 8mb of sql code i need to run. it looks like this: /* MySQL Data Transfer Source Host: 10.0.0.5 Source Database: jnetdata Target Host: 10.0.0.5 Target Database: jnetdata Date: 5/26/2009 12:27:33 PM */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for chavrusas -- ---------------------------- ...

How to determine a primary key for a table in SQL Server?

What I'd like to be able to do via SQL somehow is with a table name as input determine all the fields that make up the primary key. sp_columns doesn't seem to have this field. Any ideas as to where to look? EDIT: This is SQL Server 2005 Statement on Answer: While others may have been right his was the cleanest and easiest to implemen...