sql-server

How to clean a columns with a dots at the beginning and end of a text using T SQL for SQL Server?

Description: I have a column(EmailsAdress) on a table(BusinessUsers) on my databases that stores email address. Problem: Some of the rows of data have a dot at the beginning of this column for example [email protected] (The dot i want to get rid of is the dot just before the charater j in jane) Some of the rows of data have a...

decimal point in SQL Server

I tried to do a calculation in SQL Server and to retrieved value with 2 decimal point. However, this is always return me the value in 0 for the 2 decimal point. Does anyone know what is going on there? example: select convert(decimal(5,2),((2*100)/19), 2) as 'test' from customer The return is always 10.00 instead of 10.53 ...

Put back deleted row from another db while preserving id field

Hi, I have SQL 2005 databases. I have deleted a row from one of them and want to get it back from another database that was a backup of the row. How do isnert it while preserving its id primary key identity field? Can you give TSQL to do this assume databases are called "tbrPdata" and "tbr0910" which is the backup? Malcolm ...

Create Trigger in SQL Server

I got lost when I wanted to create trigger using the pre-defined "CREATE TRIGGER" of SQL Server 2008 R2. Could you please give me a direct SQL statement that I can use to create a trigger, and tell me how to define AFTER, BEFORE, and all that? Also, how can I know the rows UPDATED/INSERTED/DELETED, and use their column values to do oper...

Update lastest record for each key - SQL

Hello All Below is my Data Key Value Date STATUS 001 AAA 2010-01-01 E 001 BBB 2010-02-01 E 001 CCC 2010-03-01 E 002 XXX 2010-04-01 E 002 YYY 2010-05-01 E 002 ZZZ 2010-06-...

SQL command problems (C# Winforms)

Hi All, I am successfully connecting to my sql 2008 server hosted on winhost.com. But I am following this tutorial: http://www.codeproject.com/KB/database/sql_in_csharp.aspx which was suggested in an answer from: http://stackoverflow.com/questions/3357374/connecting-to-sql-server-database-c-winforms and I keep getting the exact same err...

Is it possible to make an Indexed View for a particular result I want?

Hi folks, Is it possible to create an indexed view which returns the following results :- ID | Location Name | Aliases for that Location 1 | Some Location | Alias 1, Alias 2, Alias 3 2 | Another Location | NULL 3 | Yet Another Location | NULL 4 | Last location | An Alias My table structure is Location Table LocationId INTEGER Nam...

Execute multiple aggregates at once (SQL, LINQ).. or with better performance?

I have a table with records which include a datetime column "CreationDate". I need to get the following information for every of the last 90 days: How many records were there in total in existence How many records were added on that day I could do this through a loop of counting of course, but this would hit the database 90 times.....

How to execute procedure periodically (due date and time)?

Say I have a record in a table, and this record has a "DATETIME" column; It is a DUE DATE and TIME. Whenever the server date reaches that date and time, it should notify the user (execute procedure that sends email notification for example, to the corresponding user). How would I do that? Some sites mentioned Windows Service scheduling, ...

Cursor inside Trigger not working

USE [ddb] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER [dbo].[requeststrigger] ON [dbo].[requests] AFTER INSERT,UPDATE AS BEGIN DECLARE @email VARCHAR(400); DECLARE @firstname VARCHAR(400); DECLARE @requestno VARCHAR(400); DECLARE @lastname VARCHAR(400); DECLARE @statusid INT; DECLARE thecursor CURSOR FOR SELECT i...

to compare Indian time

I want to find out what will be the time in india when clock tick to 1Am mid night in any other country.. How i will find out that through any means plz help me to find out this this is to fire birthbay mails at 1AM midnight of that resp country... ...

SQL Server - Special characters not recognise by PHP (ODBC)

Hello, I am trying to display some information from SQL Server to my PHP site. I am using ODBC connection for that one. My Issue is : Special characters are not recognised and it is displaying "question mark (?)" in my site. (This works in my other ASP site) What I am missing here ? Please help me. Thanks in advance. ...

How to join tables easily Microsoft SQL Server?

I have two separate tables used for categories. One is Categories(ID, Title, Description), and the other is SubCategories(ID, UpperID, Title, Description) I want to insert the records from categories to SubCategories with upperID=0. I've looked at SQL SELECT INTO but don't know how to use it for existing tables. ...

how to support SQL 2008 R2 in Installshield 12?

how to support SQL 2008 R2 in Installshield 12? What is change required in signature table to "maxsupportedversion" field? ...

SqlDataReader getting rows when no data

Hi! This is incredibly urgent, I need to present this application in 3 and a half hours. My application checks against a data source to see if a value exists in the database and changes values depending on whether or not the value in question was found. The problem is that I've run the sql query with the value in question in SSMS and n...

Getting the local instance of SQL Server rather than a named instance

Hi! A while ago, I wrote a web-based guestbook application that wrote it's own database. My code was very amateurish, but, as it was my very first publication, I was very happy with it. Only about a month after I'd published it did I realize I'd made a huge mistake in the code. I've only ever connected to a specific named instance of ...

update gridview and go back to the previous page

Hi there, I have a gridview, getting data from sql server, there is an Edit link to get the detailed information for example, for a user from database. this link open a new page with detailed information and when I click the updated button,I want to go back to the same page with that users informaton. I set the page size to 10, it mea...

SQl Server 2005: Rows to columns -- how to do this challenge?

Please let me know, How to convert the following data , [id] cost1 cost2 year 1 5 10 2010 1 4 15 2011 2 10 10 2010 into this format [rows of 'Year' to columns heading] id [cost1-2010] [cost2-2010] [cost1-2011] [cost2-2011] 1 5 10 4 15 2 ...

Is there a reason MySQL doesn't support FULL OUTER JOINS?

Is there a reason MySQL doesn't support FULL OUTER JOINS? I've tried full outer join syntax in mysql many times and it never worked, just found out its not supported by mysql so just curious as to why? Thank you inadvance;-) ...

Standard script database variables (Oracle vs Sql Server Terminology)

What are the differences/equivalences between Microsoft Sql and Oracle connection parameters, and are there some common names they map to? Things like "database", "instance", "username", "tablespace". From Help me put Oracle terminology into SQL Server terminology we get: | Oracle | Sql Server | Universal| ==================...