I don't know if this is even possible, so i would appreciate any ideas, even those outside of Sql Server 2005, on how this might be accomplished. I have a linked server set up to a remote mainframe and I have a simple import job that runs overnight. The problem is that the table on the mainframe that the import needs to come from is just...
Hi All,
I need to create a non sequential list of numbers that fit within a range. For instance i need to a generate a list of numbers from 1 to 1million and make sure that non of the numbers are in a sequential order, that they are completly shuffled. I guess my first question is, are there any good algorithms out there that could he...
I am a programmer, with a side job as an involuntary DBA.
I have a maintenance plan that does a full backup and a 'check database integrity' every night. I backup transaction logs every 10 minutes. The transaction log backup size spikes after the database backup - exponentially bigger. I used to rebuild indexes and statistics every n...
Can i use if else under a check constraint.
Can i use check constraint using a variable
need xplanation with eg.
...
Before running an Update statement in SQL Server Management Studio, I'd like to see how many rows it is going to affect so I know my logic is sound. Any way to do this?
I've tried running an execution plan a few times, and after running when I hover over the green update icon it shows rows affected, but sometimes it shows 20.5 rows fo...
We are using Microsoft Dynamics SL 7 (Solomon) and are having performance issues when logging into the application and pulling up information associated with accounts. Aside from a very generic approach to diagnosing the problem(s) such as running SQL Profiler, I was wondering if there was an SL specific approach to discovering performa...
I'm having troubles pulling the id from the first insert to use on the second insert. Here's my SQL (I'm using stored procedures):
DECLARE @JoinDate date
DECLARE @ID int
SET @JoinDate = getdate()
EXEC Members_Add $(UserID), '$(UserName)',
@JoinDate, '$(firstname)', '$(lastname)', NULL,
'$(Country)', NULL, '$(stateorprov...
Is there a database level function (trigger or something) that I can use to alter a DateTime field when new data is inserted? The issue is that a service I am integrating with happens to send out all of its times (in this case the time some info was received on their end) in GMT.
I need to automatically change this to reflect the time ...
I have something like this in a repository:
var results = db.EventSet.Include("Events")
.Include("TestResults")
.Include("Events.Donors")
.Include("Events.DonorPanels")
.Include("Events.Locations")
...
What is largest free datababase for SQL Server engine available for testing purposes?
...
Question:
I have a table with the columns ID, Name, Prename, Mail
Mail contains the e-mail address of a person, for example [email protected]
Now I need to check whether Name='' or Prename=''
and extract "John" from Mail and put it into Prename, and put "Doe" into column Name
Can i do that with SQL, if yes how ?
I use MS-SQL 2005
...
Hi folks,
in my SQL Server 2008 database I have a number of different tables with the same structure. I query them in different stored procedures. My first try was to pass the table name to the stored procedure, like:
CREATE PROCEDURE MyTest
@tableName nvarchar(255)
AS
BEGIN
SELECT * FROM @tableName
END
But we can't use parameter...
Consider a table like
tbl_ranks
--------------------------------
family_id | item_id | view_count
--------------------------------
1 10 101
1 11 112
1 13 109
2 21 101
2 22 112
2 23 109
3 30 101
3 31 ...
Hi all im struggling a little here with using COLLATE to ignore accents whilst also using Contains full text.
Ive reduced the columns im searching down to just one for the example here, and im hard coding the actual parameter just to simply this until i understand it.
If i have
SELECT
Col1,
Title COLLATE SQL_Latin1_General_...
We have a few huge databases (20GB+) which mostly contain static lookup data. Because our application executes joins against tables in these databases, they have to be part of each developers local SQL Server (i.e. they can't be hosted on a central, shared database server).
We plan on copying a canonical set of the actual SQL Server ...
Hi Gurus!
I have a wierd problem. I am having a web application developed in ASP.NET, the database is SQL Server Express 2005. I have written a trigger which updates another table's column value when a record is inserted or update.
The two tables are
InvtVendorInvoices (The trigger is on this table, trigger name is OnAlter_Ve...
Within my rather large database, I would like to find out everywhere a column is referenced within the entire schema (SPs, functions, tables, triggers...). I don't want to just do a text search since this will pick up comments and also will find similarly named columns from other tables.
Does anyone know if/how I can do this? I use ...
Is there some way to pass a table-valued parameter to a stored procedure in SQL Server via classic ADO?
...
Is there a way to query against a concatenated field using MS SQL? For instance, what I want to do is something like:
Select FirstName+' '+LastName as FullName from Attendees where FullName like '%Joe Schmoe%'
The above doesn't work. What I have found works is:
Select * from Attendee where FirstName+' '+LastName like '%Joe Schmoe%'
...
Can somebody explain me why this T-SQL code only returns one row with the value "1"? I was expecting to get two rows ("1" and "2"). Am I missing something here?
DECLARE @XMLDoc2 XML
SELECT @XMLDoc2 = '<ids><id>1</id><id>2</id></ids>'
DECLARE @handle2 INT
EXEC sp_xml_preparedocument @handle2 OUTPUT, @XMLDoc2
SELECT * FROM OPENXML (@ha...