I have a text column varchar(4000) with text:
'aaabbaaacbaaaccc'
and I need to remove all duplicated chars - so only one from sequence left:
'abacbac'
It should not be a function, Procedure or CLR - Regex solution. Only true SQL select.
Currently I think about using recursive WITH clause with replace 'aa'->'a', 'bb'->'b', 'cc'->'c...
Do visual studio 2010 include already Sql Server instance, or I need to install Sql Server developer edition to develop an application that need a Sql Server db.
If it installs a Sql Server express edition, it this enough or it's better to have Sql Server developer edition?
...
Why aren't my results being filtered by the members from my [Group Hierarchy] returned via the filter() statment below?
SELECT
NON EMPTY {[Measures].[Group Count], [Measures].[Overall Group Count] } ON COLUMNS,
NON EMPTY {
[Survey].[Surveys By Year].[Survey Year].ALLMEMBERS *
[Response Status].[Response S...
I have list of procedures. All procedures are not dependent upon each other. So, I need to do is, to run the independent procedures in parallel. I have 4 procedures that are to be run parallel. When the procedures are run successfully, now I need to go to the next task. These procedures create about 10 tables.
Next task is to execute th...
Hi,
I have a desktop application that needs to upload/download images to/from service computer over TCP Protocol.
At first, I stored images in file system, but I need to in MS SQL DB to compare which solution is better. Number of images is over half a million. I don't know yet will there be any limitation on size of a photo.
If you ha...
Why does this script return a pair of nulls? I'm using SQL Server 2008, script run in MSSMS.
CREATE PROCEDURE proc_Test
(
@Input int,
@Out1 int OUTPUT,
@Out2 varchar(10) OUTPUT
)
AS
BEGIN
SET NOCOUNT OFF
SET @Out1 = 100 + @Input
SET @Out2 = 'result=' + CONVERT(varchar,@Out1)
RETURN
END
GO
DECLAR...
Hello Folks,
I am trying to map a table frp, a SQL Server 2005 DB to a class which contains an enum:
public class MyClass{
private YesNoOptional addressSetting;
public YesNoOptional AddressSetting{
{get; set;}
}
}
public enum YesNoOptional {
Yes,
No,
Optional
}
This will dictate that one of three values is inserte...
We have tried it using an orm mapper tool, but it opens en closes the connection 750 times. Then we tried to construct a bulk insert, but that goes even slower...
Edit:
CREATE TABLE [dbo].[DataWarehouse](
[DataWarehouseId] [int] IDENTITY(1,1) NOT NULL,
[ColumnName] [nvarchar](max) NOT NULL,
[ColumnValue] [nvarchar](max) NOT NULL,
[RRN]...
Hi,
i have a stored procedure that has to retrieve data from multiple tables
something like
SELECT [AppointmentId]
,[ContactId]
,[Date]
,[BookedBy]
,[Details]
,[Status]
,[Time]
,[Type]
,[JobId]
,[AppointmentFor]
,(Select PersonFirstName from Person where Person_Id = [AppointmentFor]) As UserFirstName
,(Select Per...
I get the following error from the SQL Script I am trying to run:
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near ','.
This is the SQL script:
IF NOT EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = OBJECT_ID(N'[dbo].HDDB_DataSource]')
AND OBJECTPROPERTY(id, N'IsUserTable'...
Not sure if this is doable using sql alone or not, but here is the problem. I have a weird requirement that data needs to be displayed in columns so users can compare data quickly!
Here is what the result set looks like right now
CustomerID Company Active
001 ATT Y
002 ATT N
003 ATT Y
...
In a project, one of my entities is House which has many enumeration properties (for example housetype). Using .NET, Linq to Sql and Sql Server how can I create a db with enumeration and use it with Linq to Sql? What should be my approach?
...
I am working with VB.NET.. i have a DataTable called "QUESTION", containing 3 fields:
QuestionNumber (unique integer key)
QuestionText
QuestionType
In my SQL Server database I created a Table called "QUESTION" with the same fields.
QuestionNumber is defined as integer unique key, auto increment
Now, when i make a bulk copy to inser...
I have a single table in a database called Users
Users
------
ID (PK, Identity)
Username (Unique Index)
I have setup a unique index on the Username table to prevent duplicates. I am then enumerating through a collection and creating a new user in the database for each item.
What I want to do is just insert a new user and ignore the...
At the moment I write stored procedures this way:
create proc doStuff
@amount int
as
begin try
begin tran
...
if something begin select 'not_good' rollback return end
if someelse begin select 'some_other_thing' rollback return end
--do the stuff
...
commit
end try
begin catch
if @@trancount > 0 rollback
select 'error'
end catch
th...
I have the following table setup.
Bag
|
+-> BagID (Guid)
+-> BagNumber (Int)
BagCommentRelation
|
+-> BagID (Int)
+-> CommentID (Guid)
BagComment
|
+-> CommentID (Guid)
+-> Text (varchar(200))
BagCommentRelation has Foreign Keys to Bag and BagComment.
So, I turned on cascading deletes for both those Foreign Keys, ...
I just copied my current database to a new database to find out only the tables are copied,
How do I copy all stored procs the same way in one go?
I do not want to create each stored proc one by one again running create queries
Thank you in advance
This is in MS SQL
...
Hello. I have some sql table, named Object, which saves tree data in fields ObjectID, ParentID, and others. I have implemented recurse procedure, which select everything down by objectID from tree, like this:
1.
1.1.
1.2.
1.2.1.
...
Now o need to "Climb up" - by some ObjectID i need to select everything Up, like this:
1.2.1.
1.2.
1.
...
Hi!
I did an importer in VB .Net witch get data from an SQLServer an inserts this data throught ADSL connection in a remote MySQL server.
in the first time, it was like 200 records, but now there are more than 500.000 records and it expends like 11hours exporting all the data and that is bad, veryyy bad.
I need to optimize my importer,...
I am building CLR Stored Procedures and UDFs as discussed in this article:
http://www.codeproject.com/KB/cs/CLR_Stored_Procedure.aspx
When I execute Build > Deploy, I get the following error:
Error: Assembly 'system.core,
version=3.5.0.0, culture=neutral,
publickeytoken=b77a5c561934e089.' was
not found in the SQL catalog.
N...