Viewing 15 posts - 2,011 through 2,025 (of 2,171 total)
I suggested you should rewrite your stored procedure that returns the surrogate key to you, as a function instead. So I called the function fnGetNextSurrogateKey instead.
Post the code...
June 30, 2006 at 5:15 am
This will potentially lead to wrong results. What when Application + UserID is 'App131'?
Is that Application 13 and User 1, or Application 1 and User 31?
June 30, 2006 at 1:10 am
I reformated your code to be easier to understand, and this is what I got
SELECT [Start Date],
SUM(Volume),
CASE
WHEN Application = 'APP1' THEN
CASE UserID
...
June 30, 2006 at 1:06 am
There are a number of errors with your logic above, I don't know where to start. I really believe you can do without cursor. Use code something like my suggestion...
June 29, 2006 at 11:17 pm
Turn to dynamic SQL.
DECLARE @sysid int,
@sysname varchar(50),
@idxname varchar(50),
@sql varchar(500)
DECLARE mycursor CURSOR STATIC
GLOBAL SCROLL
FOR
SELECT so.id, so.name, si.name
FROM sysobjects AS so
INNER JOIN sysindexes AS si ON...
June 29, 2006 at 1:39 pm
The Quick'n'Dirty solution, which is not recommended due to the possibility of SQL injection, is to build your string with VbScript such as
sSQL = "MyStoredProcedure '" & FirstParameter & "',...
June 29, 2006 at 8:22 am
It returns <NULL> value for every ISDATE() = 0. So for all values that can't be interpreted as date [ISDATE() = 1], the
June 29, 2006 at 8:17 am
What will happen when query is longer than 8,000 characters?
June 29, 2006 at 8:15 am
Do you have some field to distinguish between blocks of persons? Or this is only for one person always?
And please do not sub-threading other people's post. Start your own thread.
June 29, 2006 at 8:13 am
Beware of the 8,000 character limit for VARCHAR variables.
I wrote an article about pivoting a few weeks back. Please read it at http://www.sqlservercentral.com/columnists/plarsson/pivottableformicrosoftsqlserver.asp
June 29, 2006 at 8:06 am
Are you trying to export to Excel or Text file? If Excel, [Sheet1$] must be replaced with a sheet name in your Excel file. If Text, the file...
June 29, 2006 at 7:58 am
Try both solutions and check the query plan. I don't think there should be a difference. However the granularity of each column could be of importance, but I think the...
June 29, 2006 at 5:28 am
OPENROWSET does.
This is an example of how to output to Excel. I don't think it will be too hard to rewrite for text files.
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Test.xls',...
June 29, 2006 at 5:23 am
Faster too, I presume.
Since the function ISDATE already have checked that the field is a valid date, there is no need to cast the field one more time before...
June 29, 2006 at 5:02 am
Let us continue to use the ISDATE function as follows for generic solution
INSERT Slimmed_down_admissions
(
PrimDiag,
Spec,
Age,
Sex,
OutputArea,
DischargeDate,
EpiStartDate,
...
June 29, 2006 at 4:46 am
Viewing 15 posts - 2,011 through 2,025 (of 2,171 total)