sql-server-2005

full text catalog don't update after insert new row

I have full text catalog for some db and table with column "name" that have full-text-index with automatic update. So I expect automatic update full text catalog when I insert new row to that table. But in facts it don't add new data to catalog until I disable full-text-index for that table and enabled it. Also full-text-catalog size alw...

Iterating through dates in SQL

Hello, I have a table of data that looks a bit like this: Name StartTime FinishTime Work Bob 2010-08-03 08:00:00 2010-08-03 12:00:00 4 Bob 2010-08-03 13:00:00 2010-08-03 16:00:00 3 Pete 2010-08-04 08:00:00 2010-08-04 12:00:00 4 Mark 2010-08-04 10:00:00 2010-08-04 12:00:...

When using SQL server management studio generate scripts, not putting guard around triggers.

I'm seeing an interesting behavior difference between my instance and my boss's instance of SSMS. When he uses Tasks->Generate Scripts... for tables, it puts guards around the triggers for that table (If exists...) but when I do the same thing using the same options SSMS doesn't put the guards around the triggers so I get errors if I run...

What could create a syntax error if you take a SQL query and perform an UNION with itself ?

I have this strange error in SQL Server 2005 where I take a working query, add the UNION keyword below it and then copy the query again. In my opinion, this should always be working, but it is not. I get the message 'Incorrect syntax near the keyword 'union'. What could create this problem ? To be more specific, here is the complete q...

Paging in T-SQL

I am trying to implement paging using Row_Number() method in this query but with no luck. The following Query uses recursive way to get Sites for a set of categories. WITH hierarchy AS ( SELECT yt.id FROM [dbo].[TH_Categories] yt WHERE yt.ID = @topicID And CultureID = @cultureID UNION ALL SELECT yt.id FROM [dbo]...

How to figure out all the instances on sql server?

I am connected to one instance of the database server. How will i come to know if there are any other instances on the same server and their names? ...

Sql Server Displaying Items in specific order

I have a list of items ItemName Manufacturer TopSalesUnit Item1 A 100 Item2 A 80 Item3 A 60 Item4 B 70 Item5 B 50 Item6 B 30 Item7 C 10 Item8 C 05 I would like the re...

Microsoft Sync Framework 2.0 : is it possible to update the column value within the same sync transaction (Client Upload Server Update) scenario?

Hello all, Let say, I have a table with 2 columns (OrderId and OrderDate). In the original design, OrderId is the surrogate (which is still somewhat meaningful to the end user since they still like to refer to OrderNumber 12345) PK with IDENTITY integer. Since we start to adopt SyncFx and to support offline client creation scenario, we...

Degree of C# support in SQL CLR user-defined function?

Hi, This may be naive but I cannot get any confirmation of this: When I write a SQL function via the SQLCLR and as a C# SQL Server Project, can the SQL function include any method/class/namespace in the .NET BCL? Are there any restrictions on what the function can do? I have full control of the SQL Server and its hosting OS, so I can am...

Implement ROW_Number() to a Specific query

I have the following query that returns a set of rows based on some input parameters : WITH hierarchy AS ( SELECT yt.id FROM [dbo].[TH_Categories] yt WHERE yt.ID = @topicID And CultureID = @cultureID UNION ALL SELECT yt.id FROM [dbo].[TH_Categories] yt JOIN hierarchy h ON h.ID = yt.Pa...

SQL Server 2005: what LINQ generated query is better - with "Where()" or "Any()" ?

var query = from c in db.Customers select c; query = query.Where(c => c.Orders.Where(o => o.OrderItems.Where(oi => oi.SellerID == sellerID).Count() > 0).Count() > 0); that generates SQL: SELECT [t0].[CustomerID], [t0].[FirstName], [t0].[LastName], [t0].[Email], [t0].[Company], [t0].[BillingAddress1], [t0].[BillingAddress2], [t0].[Shi...

One INSERT with UNIONS or multiple INSERTS?

I have a sql function that returns a table. The table is populated via 6 or so reasonably complex statements. Is it better to UNION together these statement so there is only 1 insert or are these better kept separate? Or does it make no difference whatsoever? ...

How to search content of a routine/(SP-Trigger-function)

I need to search text within a routine body (Stored Procedure, function, trigger) of all routines within a database.. How do I do that.. Thanks ...

problem with creating stored procedure and view in sql server

I have following stored procedure code when i execute it gives an error saying invalid column name Lat , Lng .These Lat and Lng variables are parameters called from c# code behind with sql query indicated at last in this particular paragraph. CREATE FUNCTION spherical_distance(@a float, @b float, @c float) RETURNS float AS BEGIN RET...

Load large xml files to database tables by reading tags quickly

I'm using SQL server 2005 loading XML data. currently I'm loading large XML files to tables via Sp's it took whole XML to a XML type sql variable and prepare document.there after i read tags i want and then insert in to table variable and finally after finishing all processing i insert all the processing records from table variable to a...

How implicit varchar to numeric works till 999 and does not work after that

The below sql works: DECLARE @VAL1 VARCHAR(50), @VAL2 INT SET @VAL1 = '999' SET @VAL2 = 6414 SELECT ROUND(CAST(((@VAL1 * 100.00)/@VAL2) AS FLOAT), 2) Where as this one fails with 'Arithmetic overflow error converting varchar to data type numeric.' DECLARE @VAL1 VARCHAR(50), @VAL2 INT SET @VAL1 = '1000' SET @VAL2 = 6414 SELECT ROUND(C...

Why are multiple records selected from a database not displayed in my HTML?

After fetching the records from an SQL server database into a HTML form with select for update via a CGI program, the multiple selected items are not being displayed as selected. I am using Perl. use CGI; use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my $q = new CGI; my $query = new CGI; my @list =ne...

windows sharepoint service sites configeration

Hello, I have two sharepoint sites in different countries how can I make the data in the two sharepoint sites to be identical. I mean when an item added to first site i want it to appear in the second site. is that possible? ...

How do i call a stored procedure or stored function from sql select statement

I have created following stored user defined it gets executed successfully. CREATE FUNCTION spherical_distance1(@a float, @b float, @c float , @Lat float, @Lng float) RETURNS float AS BEGIN RETURN ( 6371 * ACOS( COS( @a/@b ) * COS( @Lat/@b ) * COS( @Lng/@b - @c/@b ) + SIN( @a/@b ) * SIN( @Lat/@b ))) END The problem i am facin...

Save Update attempts in temp table in Update Trigger

The query is - how to Save Update attempts in temp table in Update Trigger ...