sql-server-2005

How to get server name through code if SQL Server (Standard Edition) is installed.

How to get server name through code if SQL Server (Standard Edition) is installed. We pass the server name while creating a connection string to connect SQL Server. Can we retrieve this value through code? string sqlConnectionString = string.Format( "user id={0};password={1};server={2};Trusted_Connection=no;database=TestDB; connection ...

SQL query to calculate part of visit duration from log table

Hello, I have a table which logs the userid, course, sessionid and requestdate each time a webpage is loaded. I want to calcuate the duration per userid for a given courseid. It is problematic to do this due to overlapping timespans. The data provided here should result in 10 minutes duration per user for course 1. I can't seem to get ...

Problem running scripts against SQL Server

We have some scripts that we run as part of our unit tests. This worked fine until today. We have tried running scripts with both windows and sql authentication. We have no problems logging in using sql manager Anybody have any ideas why we get the following error: Shared Memory Provider: No process is on the other end of the pip...

Can we have generalized connection string for SQL Server and SQL Server Express?

I have a WCF service that is deployed on a machine. This WCF service can be configured to either SQL Server or SQL Server Express. NOTE : The SQL database location can be other machine other then where WCF service is deployed. I put following information in XML file: user id password ServerName MachineName In case of SQL Server Ex...

SQL Free Text And Like

If I use like '%fish%' the following is returned AQUARIAN GOLDFISH FLAKES but if I use Contains([Description],' "fish*" ' ) it isn't is there something I can do? Basically I want to return anything that has the word fish in it anywhere. ...

Preferred approach for producing ranked SQL results?

Hi. I need to build some searching logic that produces ranked results. A simple example would be querying a table with firstname, lastname and zip code columns. The required output would be a list a rows that match, in order of the 'degree' of match. I.e., the top results would be those that matched on all three columns, followed by tho...

SQL Server: Need to find the origin of a particular string value

Is there a way I can search for a particular string value in a SQL SERVER 2005 database? I have this image path value that I want to modify and I think it's stored in the database. Also - is there a way that I can search for a column's name for any table in a database? Likewise, search for a tables name in a database? ...

Granting SA privileges for Developers on the development box

In spite of our vehement protests, our management has decided that the development team must be granted 'sa' rights on the development server. The catch is that we, the DB support group are still responsible for maintaining this box. We have now been entrusted the task of coming up with a list of Dos and Don'ts for the development teams...

Data driven subscription cascading parameters

I am trying to setup a data-driven subscription and it works fine except when 2 of the parameters are set to take dynamic values instead of static ones. The strucutre is basically Param1 -> read from database Param2 -> read from database Param3s -> read from database Param3 -> split Param3s (multivalued parameter, allowed val...

How do I move the same columns data within the same table without looping

Here is what I want to do: I am trying to obfuscate data and create a working database to be used for documentation. I have a list of first names that I want to mix up in a table. KEY FIRSTNAME 135 CYNTHIA 181 MARK 186 MARGARET 212 DESIVANITA 506 AMY 606 BRENDA 628 KATHLEEN 629 Johnna 636 TAMARA 652 KATHLEEN Th...

SqlBulkCopy refuses to convert String.Empty into INT NULL

Hi, Recently I've been tasked with creating an automated ETL process that pumps the data into tables based on the flat file name by reading a master mapping file. I've decided to go with SqlBulkCopy and everything seemed to be fine. IDataReader interface was implemented to read flat-files, SQL Server's meta-data provided with number of ...

Show an Advertisement 75% of the Time

Hello, I am trying to figure out a way to show an advertisement 75% of the time. I currently have a random number that is selected from 1 to 100. if the random number occurs between 1 and 75 I show the AD. Is there a better way to implement this ...

Full Text Search Index Problem

I want to search product information using Full Text Search, I have used six table in search query but i faced below issue I want to use full text search in SQL Server 2005. So I am facing the problems which is as below. 1) I am using 6 tables. i) Product (ProductID primary key,Name,Description,Summary,ImageFileNameOverride) ii) M...

Recordset returns the correct number of row but with all field empty

hi I have the same copy of access running in 3 cities right now. they work prefectly ok. they are 99% the same with one minor difference. Each of them has two views which use different odbc connection to different cities DB (all these db are SQL 2005). The views act as datasource for some two very simple queries. however, while i tried ...

How can i export table data with column name in text file in sql server 2005?

How can i export table data with column name in text file in sql server 2005? ...

data storage limitation issue

I face one problem, one column is i have taken as numeric(38,0) Data stored in this column is going out of range, means it is reach it's storage limitation. i have tried with also bigint , but facing same problem.i can not take it as varchar because i have to use in another calculation so at that time i must need to convert it from varc...

How to get web site user's Windows login name from stored procedure invoked through website

I have a web page that runs under an account named, WebUser (IIS runs under this account) Now the problem here is that, when the webpage is accessed by users (intranet), users are authenticated through Windows Authentication. The webpage calls a stored procedure, SaveClientInfo. When I was trying to get the user's name (say, User1) wh...

Does Linq to Entities Cache Queries?

I will be using Linq to Entities. The question that I have is, I will be calling Linq to Entities multiple times. Will Linq to Entities queries be cached will it is called several times? If not is there a way to cache the query so it is not compiled or generated every time it is called. ...

Problem in dynamic pivoting + sql server 2005

I have a problem. Actually in our application, earlier the customer was allowed to pay 3 installemnt per month but now it can be any number . So I have the earlier query declare @tbl table([MonthName] varchar(50), [Installment] int) insert into @tbl select 'Jan',100 union all select 'Jan',200 union all select 'Jan',300 union all sele...

Accessing text fields in a stored procedure and insert to another table

Hi, I am trying to access a “text” type and inserting that value into another table viw a stored procedure. I’ve tried to cast it, convert it, but nothing works. My code looks somethings like this: Declare @Critique varchar(max), @Feedback varchar(max) … … … SELECT @Critique = CAST(comments as varchar(max)), @Feedback = CAST(public_c...