We have a bunch of T-SQL scripts dependent on today's date and when they run. If one doesn't run on the week it should, we end up temporarily setting the system time a day before, run the script, then set it back.
Is there anyway to temporarily set the system date for a script without changing the original script, like when you execute...
Hello,
I'm trying to query a particular value in an XML field. I've seen lots of examples, but they don't seem to be what I'm looking for
Supposing my xml field is called XMLAttributes and table TableName, and the complete xml value is like the below:
<Attribute name="First2Digits" value="12" />
<Attribute name="PurchaseXXXUniqueID" ...
I have SQL Server 2005 and I am trying to export a table into an Excel file.
I right click on my database and click export. I go through the wizard and choose to export to excel then I choose my one table that I want to export and hit finished.
I get this
Messages
Error 0xc0202009: Data Flow Task: SSIS Error Code
DTS_E...
I have this table named OrdersToCall
Data types: All bigints, except for date which is a datetime
|-Order Num-|----Date--- |- Primary Ph -| Secondary Ph | Alternate Ph
|----101----| 02-07-2010 | 925-515-1234 | 916-515-1234 | 707-568-5778
|----102----| 02-07-2010 | 925-888-4141 | 925-888-4141 | 000-000-0000
|----103----| 02-07-2010 ...
I am working through an example from MSDN that uses a small database to demonstrate data driven testing, and here is the simple schema:
CREATE TABLE dbo.LogonInfoTest
(
UserId nchar(256) NOT NULL PRIMARY KEY CLUSTERED,
Password nvarchar(256) NULL,
IsValid bit NOT NULL
) ON [PRIMARY]
GO
My question is: What is the under...
Ok 3 tables, Users, Groups, and UserGroups.
The important columns are Users.UserID, Groups.GroupID, UserGroups.UserID, and UserGroups.GroupID.
I have a group we'll call group 'A', there are a bunch of Users in this group because there are many rows of UserGroups where the GroupID is the GroupID of group 'A'.
Now for all the users who ...
MS SQL Server 2005: table1 has a full text index. I want to run multiple freetexttable searches against it in a single query, but the two attempts i have fail. any help would be appreciated, thanks! p.s. am willing to upgrade to sql 2008 if it fixes this :)
CREATE FUNCTION fnt_FullTextSearch ( @s NVARCHAR(4000) )
RETURNS TABLE
AS
...
Let's say I have a table, Product, with a column called ProductName, with values like:
Lawnmower
Weedwacker
Backhoe
Gas Can
Batmobile
Now, I have a list, in Notepad, of products that should be excluded from the result set, i.e.:
Lawnmower
Weedwacker
Batmobile
In my real-life problem, there are tens of thousands of records, and thou...
I'm developing a system to process recurring billing for members. Items to be purchased can be grouped together for a special package rate, or purchased individually for a higher, stand-alone rate. The portion of my database schema that determines the amount to be paid for recurring items consists of the following 4 tables:
MEMBER_RECUR...
hai friends
i am having the table like this
TBLKEY EMPKEY EMPNAME
----------- ------------------------------ ------------------------------
1 101 RAJA
2 105 RAJA
3 106 RAJA
4 110 ...
I have a two tables which are linked by a one-to-many relationship. Now I need to sort the rows based on the key which I have in my first table.
For Ex
TeacherID StudentID
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
...
I realise what I'm asking for may be impossible. I want to perform an UPDATE on two separate tables based on a LEFT JOIN and a WHERE clause. This is my attempt:
UPDATE PERIODDATES as pd, periods2 as p2
SET pd.[PERIODCODE] = @PERIODCODE,
p2.[USERCODE] = @USERCODE
left join periods2 AS p2
ON pdates.schemeid =...
I'm looking to recategorise some relatively simple information in the most efficient way possible:
Using a limited selection of sample data:
CREATE TABLE #data
(id varchar(30)
,payent_type varchar(30)
,payment_date DATETIME)
INSERT INTO #data values ('001','single gift',DATEADD(MM,-12,GETDATE()))
INSERT INTO #data values ('001','regula...
In SQL Server Management Studio I can arrange the tables in a Database Diagram simply by right click somewhere in the diagram and select "Arrange tables".
Then tables and relationships will be plotted out in a nice way automatically.
But I can´t find a similar function in Visual Studio 2008 (in the DataSet.xsd view).
Is there a way, or...
I am trying to copy data from an old database into a new one, and transform it to follow the new db structure. The old one looked something like this:
Table 1:
Id | Col A
----------
1 0
2 8
3 7
4 1
In the new database, Table 1 now looks like this, where the data from col A is now in another table, and it's linked...
Hey all,
Got this table in SQL Server 2005, which is used to maintain a history of merging operations:
Column FROM_ID (int)
Column TO_ID (int)
Now I need a query that takes the original FROM_ID as input, and returns the last available TO_ID.
So for instance:
ID 1 is merged to ID 2
Later on, ID 2 is merged to ID 3
Again later, ID ...
While running an application load test, I am observing some weird behavior. Lock requests/sec counter is increasing in a linear fashion throughout the whole test (duration 12 hours, load levels off to a constant level within first 10 minutes). The value reached 6 million at 12 hours. There was no apparent impact to the response time of t...
I have a tree-style database with the following structure:
Table fields:
NodeID int
ParentID int
Name varchar(40)
TreeLevel int
I would like to use a variable @NodeID in the first part of the with clause to don't get all the table just start from the piece I'm interested in (see where Parent=@ParentID and comment).
with RecursionTe...
The stored procedure scripts that SQL Server Management Studio 2005 generates for me are like:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[APY_SP_ACH_Transmit_Finish]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
...
print...
hi,
i created a SSIS package on my development machine which simply:
1) Deletes records from weak table in database.
2) Loads file from filesystem into weak table in database.
3) The package is called from an asp.net page
When i run the package manually on my machine it works, when the protection level is EncryptSensitiveWithUserKey. W...