sql-server-2008

How do I return the SQL data types from my query?

I've a SQL query that queries an enormous (as in, hundreds of views/tables with hard-to-read names like CMM-CPP-FAP-ADD) database that I don't need nor want to understand. The result of this query needs to be stored in a staging table to feed a report. I need to create the staging table, but with hundreds of views/tables to dig through...

How to detemine content type of binary data in the image field of SQL Server 2008?

I need to determine file type (i.e., MimeType) of stored data in the SQL Server 2008. Is there anyway, if possible using SQL query, to identify the content type or MimeType of the binary data stored in the image column? ...

Microsoft.SqlServer.Management.Sdk.Sfc.Urn

I have the SQL2008 version of SMO and although it uses this class internally I can't figure how to bring it into scope so I can declare variables to hold values of this type. Yes I know I could declare them as object but then I'd still be unable to cast them to pass typed parameters. What reference do I need to add to my project and w...

how to quickly check communication protocol used by SQL Server

Hello everyone, I am using VSTS 2008 + C# + ADO.Net + SQL Server 2008. When connecting from another remote machine, normally TCP/IP protocol is used by ADO.Net client to connect to SQL Server 2008. When connecting locally (ADO.Net client and SQL Server on the same machine), normally shared memory or named pipe is used. My question is, ...

Nested IIfs in reporting services

Hello, can anyone help please. I need to put an IIf within an IIf within an IIf. I have a parameter called 'Period' with 4 labels, '24 Hrs, 3 Days, 7 Days, Month'. I have another Parameter ('Date' and hidden) containing the following DateSerial '=DateSerial( Datepart("YYYY",Now()),Datepart("m",Now()),Datepart("d",Now())-1 )' which ...

How to make a trasanction cover several stored procedure ?

I need to include several stored procedure in a single transaction in a single database, if any of stored procedure fail then roll back transaction of all stored procedure procesed in the scope. I work with SQL-SERVER 2008 ...

Need help with the Merge statement.

I want to update a table called Sorels_ext from a table called Sorels. The link between them is the fkey_id of Sorels_ext equals the identity_column of the Sorels table. This is my first attempt at a Merge statement and I'm trying to learn the syntax. MERGE Sorels_ext AS SORe USING (select SOR.identity_column, CASE WHEN left(SO...

Error Severity in SSIS

I need to log the Severity of Error in OnErrorCode event handler in SSIS. Severity can be like : Info, Warning, Critical I am just curious if anybody knows about how to get this information to log in EventHandler in SSIS and provide any URL which can be useful in looking for this ? ...

How do I remove a nested select from this SQL statement

Hi I have the following SQL: SELECT * FROM Name INNER JOIN ( SELECT 2 AS item, NameInAddress.NameID as itemID, NameInAddress.AddressID FROM NameInAddress INNER JOIN Address ON Address.AddressID = NameInAddress.AddressID WHERE (Address.Country != 'UK') ) AS Items ON (Items.itemID = Name .Name ID) I have been asked to r...

Converting nested Selects in WHERE .. OR .. to INNER JOINS

Hi How would I convert the following to use INNER JOIN rather than nested SELECT? SELECT [Name].[NameValueID], [Name].[NameTypeID], [Name].[NameID], [Name].[Value] FROM [Name] WHERE Name.NameTypeID IN ( SELECT NameTypeID FROM @tbNameType ) OR Name.NameID IN ( SELECT NameID FROM @tbName) ...

SSAS data sourcing with Netezza

We were extracting data out of Netezza into txt files, loading into SQL Server and processing our SSAS cube(s) from there. We want to change that and load the cube directly from Netezza. What are the things to keep in mind for this? ...

SQL Query Help for Queue Quantities

I have a database which has an orders table and inventory table. The order-items table has a 1 record per 1 qty layout, so if a person places an order for 7 'ABC's, and 4 'XYZ's, I get 11 records in the table. id, item, qtyNum 01 ABC 1 02 ABC 2 03 ABC 3 04 ABC 4 05 ABC 5 06 ABC 6 07 ABC 7 08 XYZ 1 09 XYZ 2 10 XYZ 3 11 XYZ 4 The...

Table vs Temp Table Performance

Which is faster for millions of records: Permanent Table or Temp Tables? I have to use it only for 15 million records. after Processing complete. we delete these records.. ...

Using SQL Server 2008 Date Data Type to Store Year

Does it make any sense to store just a year in the new Date SQL type in SQL 2008? My boss wanted this but we're prompting the customer to enter year optional in a web form..just 4 integers. I don't see why we'd use Date datatype as that also includes day and month and I've already got those seperated out into int fields in our DB table...

T-SQL - create partition function and scheme - SQL Server 2008

I am creating partition function and schemes. In SQL Server 2008, it only defines range partitioning and not list partitions. Dont we have list partitioning in SQL Server? I am using SQL Server 2008 Enterprise edition. ...

Using SQRT in a Linq EF Query

I need to use the SQRT function as part of a where clause in a Linq EF query. I figured I could do this: var qry = context.MyTable.Where("sqrt(it.field) > 1"); But it returns an error saying "'sqrt' cannot be resolved into a valid type constructor or function., near function, method or type constructor, line 6, column 5." I had alwa...

The request failed or the service did not respond in a timely fashion?

I have the following error while I connect to SQL Server 2008 Management Studio with Windows authentication. "The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details." Is anybody tell me why i am getting this error, whereas my SQL Server is running under n...

Looking for a simple ASP.Net web site sample

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ADO.Net + ASP.Net + SQL Server 2008 Enterprise + IIS 7.0. I want to save my time to write an simple ASP.Net web site. And want to see if I can find an available one here. :-) What I need is very simple, (1) basic UI (2) could edit/update/delete data from database (any kinds of data...

Is it possible to use SqlBulkCopy in SQL 2008 without permission 'db_datawriter' ?

I want to limit my database possible access ways to only using stored procedures. Everything works fine except System.Data.SqlClient.SqlBulkCopy. I'm using it only in one class for massive data import. Is it possible to avoid this problem? I tried to grant a right before calling SqlBulkCopy and remove it after: EXEC [db_mod].[sys].[sp...

Creating a Data Generation Plan that Includes Correct Lookup Table Values

I'm just getting started with Visual Studio Database projects and loving the data generation plans I can create with it. However, in one of my projects I need to populate a lookup table with specific values. Since a foreign-key relationship exists between the lookup table and another table, I can't remove the lookup table from the data g...