sql-server

Outer join problem in SQL Server

This is my query. And I want all rows of BF and matched rows of FT. It returns only 2 rows but the real row count is 135. How should I change my query? SELECT BF.FaturaNo, K.KlinikAdi, FT.teslimAlindi, FT.TeslimAciklama, FT.kurumTeslimAldi, FT.kurumTeslimAciklama, BF.basilmisFatura_id, K.klinik_id FROM BasilmisFatura...

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? ...

sql 2008 Installation problem

Does vista supports sql 2008 ..... ...

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...

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 ...

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 Log Number of Rows affected by SSIS Execute SQL Task

When I execute a sql statement like "Select ...", I can only see "...100%" completed... I want to log the number of rows affected. How can we do that? ...

Creating a SQL Server table from a C# datatable

I have a DataTable that I manually created and loaded with data using C#. What would be the most efficient way to create a table in SQL Server 2005 that uses the columns and data in the DataTable? ...

Slow SqlCommand performance with longer CommandText

Does the length of the CommandText of an SqlCommand make a difference? I'm not talking about thousands of characters either. Here's what I have: SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; for (int i=0; i<1000; ++i) { string name = i.ToString() + "Bob" + i.ToString(); string email = i.ToSt...

How do I build XQuerys to include/exclude rows based on the presence of certain tags and attributes?

I have an auditing/logging system that uses raw XML to represent actions taken out by an application. I'd like to improve on this system greatly by using an XML column in a table in the application's SQL Server database. Each row in the table would contain one log entry and each entry should contain one or more tags that are used to de...

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...

Hijacking connection string with network packet analyzer

I guess everything is possible but I am wondering how easy is it for someone to hijack a connection string with a network packet analyzer or equivalent tool. A winforms application fetches data directly from an MSSQL server. (Supposing there are no webservices in the middle for extra protection) 1) Is it possible for someone with an a...

How to refresh a test instance of SQL server with production data without using full backups

I have two MS SQL 2005 servers, one for production and one for test and both have a Recovery Model of Full. I restore a backup of the production database to the test server and then have users make changes. I want to be able to: Roll back all the changes made to the test SQL server Apply all the transactions that have occurred on the ...

copy Ms access single Big Table to Sql server two small tables

Dear friends, I have single big table in Ms access 2k daabase and i need a way to copy this table and then populate my two already ready tables on sql server . I can use Migration tool but is there any way we can do it from Ms access like a form which executes the stored procedure or ODBC connection. what i am thinking is to create a ...

Select Fails With Nonexisitent Columns

Executing the following statement with SQL Server 2005 (My tests are through SSMS) results in success upon first execution and failure upon subsequent executions. IF OBJECT_ID('tempdb..#test') IS NULL CREATE TABLE #test ( GoodColumn INT ) IF 1 = 0 SELECT BadColumn FROM #test What this means is that something is co...

Sql Express 2005 Limit

Hi, I'm using SQL Express 2005 for an asp.net application which only uses Membership management.I've known that this edition has 4GB limit,but even it has I wish to know how much space I'm using in. Is limit possible to be checked from either SQL Express Management Studio or by code (c#)? (i.e 2.34 GB is in use) ...

SSAS 2005: working with database slow after processing

I have a SSAS 2005 database with 10 cubes. When I create the cubes from an XMLA script, it works fast, and I can browse cubes from SSMS, just as I should. After processing the cubes during the night, eveyrthing starts to work VERY slow. Opening cube list in SSMS takes few minutes, and it is like this all the time. What can cause this? ...