sql-server-2008

Recursive sort of T-SQL query

Hi Based on the following table ID Path --------------------------------------- 1 \\Root 2 \\Root\Node0 3 \\Root\Node0\Node1 4 \\Root\Node0\Node2 5 \\Root\Node3 6 \\Root\Node3\Node4 7 \\Root\Node5 ... N \\Root\Node5\Node6\Node7\Node8\Node9\Node10 so on... There are around 1000 rows in this table. I want to display ...

Executing a .NET Managed Assembly from SQL Server 2008 - Pro's, Con's & Recommendations

Hi guys, looking for opinions/recommendations/links for the following scenario im currently facing. The Platform: .NET 4.0 Web Application SQL Server 2008 The Task: Overhaul a component of the system that performs (fairly) complex mathematical operations based on a specific user activity, and updates numerous tables in the databas...

Is SSIS able to query flat files from another Windows Server?

I pretty new SQL Server Integration Server (SSIS) user. Is SSIS able to query data from text files located in another Windows Server? I mean that when SSIS is installed on Windwos Server A, is SSIS able to query data from e.g. one folder containing text files in Windows Server B (under same domain)? I have used only SAP BO Data Integrato...

CONTAINSTABLE with wildcard works different in SQL Server 2005 and SQL Server 2008?

I have two same databases one on SQL Server 2005 and one on SQL Server 2008, it have same SQL_Latin1_General_CP1_CI_AS Collation, and full text search catalogs have the same settings. These two databases contains table with same data, NTEXT string: "...kræve en forklaring fra miljøminister Connie Hedegaard.." My problem is: CONTAINST...

un able to connect my database to visual studio 2008

hey, i`m stuck on it.. plx help.. my database is created on mssql 2008 and have connected on sql server compact edition and not on windows authentication.. can any body please help me out.. ...

Is there a way to prevent Triggers from being disabled?

I have a trigger on a table that should never be disabled. It performs certain checks and there have been occasions when other developers have disabled it to get around it. This is not good so I want to be able to turn off trigger disablement on this table alone. Is this possible? If not, any suggestions please. thanks. WORKAROUND:...

Find invalid dates in SQL Server 2008

I have a 300.000 rows table; one of the columns is a varchar() but it really contains a date xx/xx/xxxx or x/x/xxxx or similar. But executing the following test yields an error: SELECT CAST(MyDate as Datetime) FROM MyTable The problem is that it doesn’t tell me in which row… I have executed a series of “manual” updates by trial an er...

openquery issue in SQL Server

Hello everyone, I am using SQL Server 2008 (let us call this source database server in this question discussion), and in SSMS, I have created a linked server to another SQL Server 2008 database (let us call this destination database server in this question discussion). When I issue statement -- select * from [linked server name]....

C# dataset and DbNull values.

Hi All. I've a general question - Lets say I've an SQL Server 2008 DB , and it has some nullable columns. Some of these are null and some are not. Next, I query the DB for a DataRow in C#. What value would these null fields have in the DataRow object? I'm seeing that they have C# "null" values, but someone here said that DbNull != C#...

Maintainging default values when importing a sql database into a vb.net application

Hello, I am trying to copy a sql database into a vb.net application however it is not maintaining the default values when I do this. Is it possible to import the default values and have them automatically assigned when creating a new row or do I have to manually assign the default values again in my code? ...

Problems with sp_addlinkedserver in SQL Server 2000

Hi! I'm having a bit of a problem with moving specific data from one server running SQL Server 2000 (A) and another running SQL Server 2008 (B). I'm writing a script according to customer specifications which is to be executed on A, populating tables in B with data. However, I can't seem to get the server link to work. -- Bunch of decl...

Select dynamic string has a different value when referenced in Where clause

I dynamically select a string built using another string. So, if string1='David Banner', then MyDynamicString should be 'DBanne' Select ... , Left( left((select top 1 strval from dbo.SPLIT(string1,' ')) //first word ,1) //first character + (select top 1 strval from dbo.SPLIT(string1,' ') //second word wher...

Get recursive data with sql server

I am trying to get recursive data. Following code returns all parents on the top and then the children. I would like to get data Parent 1 – his children then parent 2 - his children then parent3 – his children. How do I do this? USE Subscriber GO WITH Parent (ParentId, Id, Name,subscriberID) AS ( -- Anchor member definition SELECT...

Where are registered servers stored??

I'm using SMS 2008 & I'm looking for where the registered servers are stores on my local machine. I have searched the registry with no luck. AHIA, Larry... ...

SQL Server 2008 Splitting string variable number of token per line

I have a fairly simple requirement -I have a table with the following (relevant) structure. with cte as( select 1 id,'AA,AB,AC,AD' names union all select 2,'BA,BB' union all select 3,'CA,CB,CC,CD,CE' union all select 4,'DA,DB,DC' ) i would like to create a select statement which will split each "names" column into multiple rows. For...

I get an error when implementing tde in SQL Server 2008

USE MyDatabase GO CREATE DATABASE ENCRYPTION KEY WITH ENCRYPTION ALGORITHM = AES_256 BY SERVER CERTIFICATE TDECert GO when i execute this statement in SQL Server 2008 I get the error: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'KEY'. Msg 319, Level 15, State 1, Line 2 Incorrect syntax near the key...

What operation type invoked a trigger in SQL Server 2008?

I'm contemplating a single SQL trigger to handle INSERT, UPDATE and DELETE operations as part of an auditing process. Is there any statement, function or @@ variable I can interrogate to find out which operation type launched the trigger? I've seen the following pattern: declare @type char(1) if exists (select * from inserted) if ...

SQLServer 2008 : Name of backup file

Hello I have a SQL server 2008 and I would change the name of the backup file. I use an SSIS package to perform my backups. The file's name looks like [DATABASE_NAME]_backup_YYYY_MM_DD_XXXXXX_XXXXXX This is automatically generated by SqlServer, and I want to remove the "_". How I can modify this ? Thank you in advance, Andy. ...

Microsoft.SqlServer.Management.Smo.Transfer class

I'm trying to copy sql db between servers using Smo.Transfer class. And it's ok when you're copying absolutely normal database. It works. But what if your data inconsistent? For example I have a function and it gets the value from a table and non-existed column (someone renamed the column and now the function wouldn't work). But if yo...

Show two differents values from the same field

HI, i have two tables 1- name, id, code 2- id, value, concept One name can have two concepts and two values. i want to retreive this: Id, name, value1, value2. How can i do that? Tanks ...