sql-server

SQL Server unique constraint problem

How to create a unique constraint on a varchar(max) field in visual studio, visually. the problem is when i try it: manage indexes and keys > add > columns I can only chose the bigint columns, but not any of the varchar(max) ones. Do I maybe have to use check constraints? If yes, what to put in the expression? Thnx for the info ...

Django-pyodbc SQL Server/freetds server connection problems on linux

Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)') I'm migrating from developing on a windows development machine to Linux machine in production and I'm having issues with the freetds driver. As far as I can tell that error message means it ...

What is the current status on Microsoft ProClarity?

I don't really know how to compose this question. My complay has been using Microsoft ProClarity for few years and we have a quite a few users using it publising books and doing ad-hoc analysis. With the new Microsoft BI solutions, it seems like they are completely going away from ProClarity and replacing the OLAP analysis with Excel. I ...

Is it possible to have a multilanguage Environnement in SQL Server 2008 ide

Hi! is it possible to install another interface language to SQL Server 2008 Management Studio? Im not talking about programming language but changing the interface language from English to French (or others). In Visual Studio, i can do it by installing the english and the french version of the product and then, in the option of Visual ...

How to convert SQL Statement with TOP, COUNT and GROUP BY to return an object list with LINQ

Hello guys does anyone know how to convert this SQL statement to a LINQ to a List? SELECT TOP(5) COUNT(Tickets.CategoryId), Categories.CategoryName FROM Tickets INNER JOIN Categories ON Tickets.CategoryId = Categories.CategoryId GROUP BY Categories.CategoryName ORDER BY 1 DESC The result would be something like this? public static ...

Dynamic query runs directly but not through variable, what could be the reason?

Here is my scenario, I'm creating a dynamic query using a select statement which uses functions to generate the query. I am storing it into a variable and running it using exec. i.e. declare @dsql nvarchar(max) set @dsql = '' select @dsql = @dsql + dbo.getDynmicQuery(column1, column2) from Table1 exec(@dsql) Now it produces the many...

how can I insert value into a table in sql server 2000 , 2005, 2008?

I have a table having a single auto Auto Incremented column. How Can i insert the value. Using Insert into table or some other way Thanks Waiting for your replay.. ...

how to connect SQL Server cubes using dotnet(C#)

Hi. I am new to this cubes concept in SQL Server. I need to connect to cubes and query and get a result and display that result in grid view Any help would be great telling how to connect to a cube, articles on it, code any thing that can help me to achieve the result Thank you. ...

How do I use Entity Framework in a CLR stored procedure?

I am looking forward to move all the logic (which is implemented as manipulating Entity Framework 4 objects) to a server side. It looks going to be simple (thanks to the application structure) and beneficial (as all I have is one oldy laptop as a client and one tough server which runs SQL Server 2008, and building a separate service for ...

How to declare a variable in SQL Server and use it in the same Stored Procedure

Im trying to get the value from BrandID in one table and add it to another table. But I can't get it to work. Anybody know how to do it right? CREATE PROCEDURE AddBrand AS DECLARE @BrandName nvarchar(50), @CategoryID int, @BrandID int SELECT @BrandID = BrandID FROM tblBrand WHERE BrandName = @BrandName INSERT INTO tblBrandinCategor...

Rename the table Column

Hi all, I am trying to execute the following query. I don't have 'CrewID' column so in that case it will by pass update part of the script. but it gives error Invalid object CrewID'. Can you please tell me why it excute update part even my if condition does not matched. Is there is another way to do the same. I have the requirement where...

SQL reporting services reference

Hi everyone, I want to add service reference to SQL reporting services on local machine. In Reporting Service Configuration Manager under Web Service URL tab I have report service URL exposed, I have tried to add web reference to project with that Web Reference URL, but it can not be found. Please tell me am I missing something or is...

Parameter cannot be null error after success save

I am getting the following nhibernate error when saving an entity (via: NHibernateSession.Save(entity);) despite it being persisted to the database fine "Value cannot be null.Parameter name: id" This is my hbm file <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="mydatabase.Doma...

Best data store for billions of rows

I need to be able to store small bits of data (approximately 50-75 bytes) for billions of records (~3 billion/month for a year). The only requirement is fast inserts and fast lookups for all records with the same GUID and the ability to access the data store from .net. I'm a SQL server guy and I think SQL Server can do this, but with a...

Transaction within a Transaction in C#

I'm importing a flat file of invoices into a database using C#. I'm using the TransactionScope to roll back the entire operation if a problem is encountered. It is a tricky input file, in that one row does not necessary equal one record. It also includes linked records. An invoice would have a header line, line items, and then a total...

SQL Server 2008 log size management problems

I'm trying to shrink the log of a database AND set the recovery to simple, but always there is an error, whatever i try. USE 4_o5; GO ALTER DATABASE 4_o5 SET RECOVERY SIMPLE; GO DBCC SHRINKFILE (4_o5_log, 10); GO the output of sp_helpfile says that log file is located under (hosted solution): I:\dataroot\4_o5_log.LDF please help me...

Removing Database References from an ASP.NET MVC Site

I'm building a very simple ASP.NET MVC site that doesn't require a database and doesn't have user accounts or any other special ASP.NET stuff. When I first created the site with the ASP.NET MVC 1.0 site template in Visual Studio, the web.config page was configured to automatically connect to SQL Server Express as a User Instance. Can I...

TSQL Query - return all seconds between two dates

I need a TSQL query which returns all seconds since a given begin date. I am going to use this to left outer join against another table to see how many bytes were downloaded each second. I am using Sql Server 2008. ...

Access to SQL Server 2005 from a non-domain machine using Windows authentication

Hi, I have a Windows domain within which a machine is running SQL Server 2005 and which is configured to support only Windows authentication. I would like to run a C# client application on a machine on the same network, but which is NOT on the domain, and access a database on the SQL Server 2005 instance. I thought that it would be a si...

Receiving SQL Server events from a CLR function

I wrote a CLR class with several methods, which are linked as functions in a SQL Server 2005 database. When several of these functions are used in scope of one transaction or connection, I need another one to be automatically executed to clean up some stuff, at the time of transaction or connection close (either time is good for now, lat...