sql-server-2005

Reporting Services - hide table column based upon report parameter

I have a report in Reporting Services 2005, and I want to hide or show a single table column based upon a report parameter. Does anyone have any idea how to do that? Thanks! ...

Sql Trigger - which table does it belong to?

Is there a way within a Sql Server 2005 Trigger to get the name and schema of the table that the trigger is attached to during execution? ...

Use variables expansions in schema in sql server 2005 / 2008

I am trying to create stored procedure which will decide which language to use based on a parameter passed? How can I do something like this ? declare @en varchar(50) = 'en' declare @fi varchar(50) = 'fi' select * from [@en].[TestingLanguagesInNameSpacesDelMe] select * from [@fi].[TestingLanguagesInNameSpacesDelMe] ...

select statement to return the column names in a table

Is there any select statement to return the list of columns in the table? ...

Disable Foreign key constraint on a table?

Can i temporaryly disable a foreign key constraint. How do i do this? ...

convert a string to int using sql query

i want to convert a string field to integer using sql query? ...

Can you do a select on the results of a stored procedure in T-SQL

select * from (EXEC sp_SomeStoredProc) If you can't do this then what is stopping it from being added to the SQL standard or T-SQL? ...

SQL Express User Instance with multiple ASP.NET Sites

How can I get two separate ASP.NET sites, in this case a Web Site using Entity Framework and Web Service, to use the same local database mdf & ldf? I looked around and I think that this kind of local DB is called a User Instance - at least they way I'm currently using it. I wasn't sure if it would work or not until I found the below in...

How to I add SSIS Packages to the MSDB database on SQL Server 2005?

I have SQL Server 2005 install on my PC and am having execution problems with an SSIS Package stored in the filesystem. I want to stored this in the MSDB database but don't know how to do this. I watched this video: http://download.microsoft.com/download/5/3/0/5303799D-8739-4BDC-8062-337368357391/SQLServerAgentTroubleshoot.wmv This vid...

SQL update with a join?

I have two tables. One is simple string/ID look up: StrTable: str_key String 0 'a' 1 'b' where the strings are unique. The other is more complex, and includes the shared string_id ValTable: str_key other_key val 0 0 1.234 0 1 1.567 1 0 1.890 Now, I want to do an update on Va...

How to filter nvarchar greater than numeric value?

I have a MS SQL table McTable with column BigMacs nvarchar(255). I would like to get rows with BigMacs value greater than 5. What I do is: select * from ( select BigMacs BigMacsS, CAST(BigMacs as Binary) BigMacsB, CAST(BigMacs as int) BigMacsL from McTable where BigMacs Like '%[0-9]%' ...

how can i add select query result into dataset later again select query run...

i want to add select query result into dataset, so i can write new query to run on it to get net dataset but how? Original query: MyDATASET=( select x, y,z from table1 union all select k,l,m from table2 ) i wan to this select * from this.MyDATASET ...

SQL server profiler not showing LINQ To Sql queries

I am trying to view SQL generated by Linq to SQL in the SQL Server Profiler (2005). I can see the sql sent to the server from anything except for linq to sql. I'm betting that I need to change event selections for the trace, but not sure what else to select. I am currently only selecting this: SQL:StmtCompleted - TextData & SPID I do...

How do I create a new database from a saved schema script in SQL Server 2005?

I used the Database Publishing Wizard to generate a script of the schema for a database, how do I make a new database based on this .sql file? ...

select column name with maximum date from various column in a table

I have a table with four columns with different dates. I want to retrieve a column name with maximum date; can any one help on how to go about that? ...

SQL: 3 self-joins and then join them together

I have 2 tables to join in a specific way. I think my query is right, but not sure. select t1.userID, t3.Answer Unit, t5.Answer Demo FROM table1 t1 inner join (select * from table2) t3 ON t1.userID = t3.userID inner join (select * from table2) t5 ON t1.userID = t5.userID where NOT EXISTS (SELECT * FROM ...

How do I combine these two SQL statements into one, in a manner compatible with both MSSQL 2000 and 2005?

My end goal is to accomplish something like: CREATE FOREIGN KEY IF NOT EXISTS FOREIGN KEY Since that statement doesn't appear to exist, I'm attempting to sort of kludge it together. I have a statement that will return the FK name if it exists: SELECT f.name AS ForeignKey FROM sys.foreign_keys AS f WHERE OBJECT_NAME(f.parent_object_...

What does this SQL error mean

Exception: "Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction" This is hapening inside a SProc running on a machine having both SQL 2005 and Sql 2008 hosted. The C# code looks something like this (using TransactionScope t = new TransactionScope ()) { using(SqlConnection c= ne...

What privileges are required to store an SSIS package in SQL Server 2008

Hi, I want create SSIS package as a DB User. Also I want to store it to SQL Server not in file system. The DB user only have a db_owner privilege on a particular database. What least privileges are required to create SSIS. Already I have assigned the following grant execute on dbo.sp_ssis_checkexists to test grant execute on dbo.sp_...

Deploy a CLR Trigger/Stored Procedure using WiX

As the founder's of stackoverflow talk so much about being able to deploy changes easy, I'm trying to come up with a solution to solve my issue. A quick background is that a client contacted me and needed something done on the database that is quite not so trivial, but isn't horribly difficult to do (took me about a day to get the proce...