i have a table that has following column
Type
--------
type 1
type 2
type 3
How can i convert the above to a string like ('type 1', 'type 2', 'type 3')
I want to use the output in my t-sql query with IN clause. Something like select * from TableA where SomeColumn IN ('Type 1','Type 2', Type 3')
I used to following to come up with ou...
I have a stored procedure which basically does something like
select top 1 expiryDate, flag, (bunch of other columns)
from someTable
(bunch of joins)
order by expiryDate desc
So this will grab the record that expires last. This works for most cases, except some records have a flag that are just a char(1). Most of the time it's just Y ...
I have installed SQL Server 2005 three times now on the same box. I cleaned up registry settings, files, you name it.
All along I have been trying to install SQL Server 2005 Database and Reporting Services (x64) on a Windows 2008 Server. I have also applied the SP3 patch. Installing and Restarting the Server at every point. Verifi...
I have the following scalar function in MS SQL 2005:
CREATE FUNCTION [dbo].[Distance] ( @lat1 float, @long1 float,@lat2 float, @long2 float )
RETURNS float
AS
BEGIN
RETURN (3958*3.1415926*sqrt((@lat2-@lat1)*(@lat2-@lat1) + cos(@lat2/57.29578)*cos(@lat1/57.29578)*(@long2-@long1)*(@long2-@long1))/180);
END
I need to be able to call...
Hi there. I am developing in Visual Web developer 2008. I have SQLEXPRESS 2005 and SQL Management Studio 2008 installed on my PC. I purchased a Database MS SQL 2008 on DiscountASP.net. Since the host provides only 1 database and my project has 2 database. One is the ASPNETDB that contains the roles and user etc (created using the Website...
i try a lot of commands to disable tables constraints in my database to make truncate to all tables but still now it give me the same error
Cannot truncate table '' because it is being referenced by a FOREIGN KEY constraint.
i try
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
EXEC sp_MSforeachtable "TRUNCATE TABLE ?"
...
Hi,
I have a table ClassAttendance and I'm using MSSQL 2005
studentID attendanceDate status
-------------------------------------
*1004 2010-03-17 0
1005 2010-03-17 1
1006 2010-03-17 0
1007 2010-03-17 0
*1004 2010-03-19 0
1005 2010-03-19 ...
Hi there,
I'm using SQL Server and I want to use identity constraint in it
I know how to use it in following manner
create table mytable
(
c1 int primary key identity(1,1);
)
the above code works fine but what if i want the identity column to have values as EMP001, EMP002,... instead of 1,2....
Thanks in advance,
Guru
...
Hi,
I want to connect from home using SQL Server 2005 to another PC.
I had a look on the msd...but before connecting it says I should connect to another computer
using the computer management and it didn't work out....I can only connect to computers from my workgroup?
Thanks,
Luisa
...
I am working on a script, that needs to be run in many different SQL servers. Some of them, shared the same structure, in other words, they are identical, but the filegroups and the DB names are different. This is because is one per client.
Anyway, I would like when running a script, If I chose the wrong DB, it should not be executed. I...
I have a table in which there are two columns : 1. import type, 2. Excel import template.
The second column - "Excel import template" should store the whole excel file.
How would I save excel file in databse...can I use binary datatype column, convert excel file to bytes and save the same ?
Thanks in advance !
...
I've created small database under SQL Server 2008. Now i wanted to move it to SQL Server 2005 and it doesn't work since it doesn't have Time datatype. What option do I have to store only time in SQL Server 2005. I've written small TimeSheet application which needs to write hours and minutes mostly in format like 05:30:00 (hh:mm:ss) but s...
Scenario
I have an TWO datbase tables of exactly the SAME STRUCTURE. The difference between these tables is that one contains data populated by one application and the other is populated by a different application. Each application is trying to produce the same result, but using two different methods of implementation.
Proposed Idea
W...
Hi Team,
I am using SQL Server 2005. I have a requirement to list out all the tables (and the column) whcih has the value 'xyzeee'.
Is there a query to achieve this?
Thanks
Lijo
...
Is there a way to query a full text index to help determine additional noise words? I would like to add some custom noise words and wondered if theres a way to analyse the index to help determine suggestions.
...
I may be approaching this problem from the wrong angle but what I'm thinking of is some kind of performance monitor tool for SQl server that works in a similar way to code performance tools, e.g. I;d like to see an output of how many times each stored procedure was called, average executuion time and possibly various resource usage stats...
Hi,
I have a table in which there are two columns : 1. import type, 2. Excel import template.
The second column - "Excel import template" should store the whole excel file.
How would I save excel file in databse...can I use binary datatype column, convert excel file to bytes and save the same ?
Thanks in advance !
...
I have a simple user production report where daily quotas are tracked. The sql returns a weeks worth of data for all users and for each day it tracks their totals. The problem is if they are out for a day and have a zero production for that day then the result query just skips that day and leaves it out. I want to return days even if the...
How can I create View on Linked Server db. For Example I have a linked server [0.0.0.0] on [1.1.1.1]. Both db servers are SQL Sserver 2005. I want to create View on [1.1.1.1] using table on linked server.
EDIT:
On creating using full name, [0.0.0.0].db.dbo.table, I am getting this error.
SQL Execution Error.
Executed SQL statement: S...
Got a problem with a query I'm trying to write. I have a table that lists people that have been sent an email. There is a bit column named Active which is set to true if they have responded. But I need to count the number of consecutive emails the person has been inactive since either their first email or last active email.
For example,...