|
I am probabely be called an idiot rom now on but I can't figure this out, tried everything. Here I have to trasfer in SQL a very disfunctionnal FMP database. This is the function that verifies the dates. The problem I have is this:
It works perfectly when the original date (formatted 01/01/1800) is correct but the last part should overwrite any malformed date (anyways that was the intention....) but none get overwritten. I always get the malformed date back. It is as if @DateTest never gets put to False. Help!!
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[GetBirthDate]
(
@BirthDate nvarchar(10)
)
RETURNS nvarchar(10)
AS
BEGIN
DECLARE @ReturnValue nvarchar(10)
DECLARE @DateTest bit
SET @DateTest = 'True'
IF (@BirthDate = '00/00/00' OR @BirthDate = '' OR @BirthDate = '?' OR @BirthDate IS NULL)
SET @ReturnValue = '1800-01-01'
ELSE
BEGIN
IF LEN(@BirthDate) = 10
SET @ReturnValue = SUBSTRING(@BirthDate, 7, 4) + '-' + SUBSTRING(@BirthDate, 4, 2) + '-' + LEFT(@BirthDate, 2)
ELSE
SET @ReturnValue = '19' + SUBSTRING(@BirthDate, 7, 2) + '-' + SUBSTRING(@BirthDate, 4, 2) + '-' + LEFT(@BirthDate, 2)
END
IF (SUBSTRING(@ReturnValue, 1, 2) <> '19' AND SUBSTRING(@ReturnValue, 1, 2) <> '20') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 3, 1) < '0' OR SUBSTRING(@ReturnValue, 3, 2) > '9') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 4, 1) < '0' OR SUBSTRING(@ReturnValue, 4, 2) > '9') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 6, 1) < '0' OR SUBSTRING(@ReturnValue, 6, 2) > '1') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 7, 1) < '0' OR SUBSTRING(@ReturnValue, 7, 2) > '9') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 9, 1) < '0' OR SUBSTRING(@ReturnValue, 9, 2) > '3') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 10, 1) < '0' OR SUBSTRING(@ReturnValue, 10, 2) > '9') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 5, 1) <> '-') SET @DateTest = 'False'
IF (SUBSTRING(@ReturnValue, 8, 1) <> '-') SET @DateTest = 'False'
IF @DateTest = 'False' SET @ReturnValue = '1800-01-01'
RETURN @ReturnValue
END
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
|
|
|
|
|
I had to answer to this one myself, this is too funny. My stored procedure was calling another function I wrote that had a similar name
It was a pleasure wasting everybody's time ! ;P
|
|
|
|
|
Hi,
I am using Enterprise Library April 2007, and wanted to know what DbType is a uniqueidentifier data type?? Like when I have for example:
db.AddInParameter(command, "@FirstName", DbType.String, info.FirstName); // Required
How would I do it for a uniqueidentifier data type?
Please can someone help me?
Regards
ma se
|
|
|
|
|
|
Hi,
You should use DbType.Guid
db.AddInParameter(command, "@FirstName", DbType.Guid, info.FirstName);
|
|
|
|
|
am writting a database application, i have an Error
<br />
SqlDataAdapter1.Fill(DsValRoll1)<br />
Am using Visual Studio 2003,and Sql 2000, after installing Visual Studio, i had a message that says, you must Download and install SQlDesktop Engine, i have lost the i need the Address where i can Download the SQlDesktop Engine for Visual Studio 2003 ans SQl 2000
Thanks
-- modified at 10:37 Monday 11th June, 2007
Vuyiswa
|
|
|
|
|
|
|
I have oracle DBF files and I would like to know if there is any way to export data from them?
I`m MSSQL user and I don`t know much about oracle .. I have just few DBF files and one ORA file and I don`t know how to export data from them.
Any help appreciated.
Thanks,
Ivan
|
|
|
|
|
Hi Ivan
You would need to install Oracle (you may be able to get away with the Express edition), then attach the DBF files. Once you have an Oracle database up-and-running then you can use DTS or SSIS to transfer the data to your SQL-Server instance.
If you have access to an Oracle DBA then you will save yourself a bunch of time.
Otherwise you may find that one of the Oracle-specific forums will be able to provide more detailed advice on attaching Oracle databases - just don't tell them that you intend to rip the data in SQL-Server cos that will seriously hurt their feelings
Regards
Andy
|
|
|
|
|
Andy thank you for instructions !
I have had same thinking as you ... so I have started downloading oracle 10g express and SQL developer. Any forums you would recommend ?
Thanks allot!
|
|
|
|
|
I've never used any Oracle forums - but if I did then Ask Tom[^] would be the first place I would look.
Good luck.
|
|
|
|
|
This is old, but I couldn't resist.
Instead of getting his technical input from forums or even from Tom Kyte, he should be doing what Tom himself would say--RTFM!
Kind regards,
Russ
|
|
|
|
|
Dear Team,
We face the issue of Process Blocking in SQL2000 very often which leads to the show stopper of the application for which we will have to kill the Process manually , is there any was to find why the Process blocking in SQL coz of the application or is there any other work around to fix this issue.
Thanks & Regards,
Jayaraman B
Jayaraman B
|
|
|
|
|
Do you mean that SQL sessions are blocking on other user's sessions because of locking?
This can be detected using the "sp_who2" stored procedure. The normal ways of reducing lock contention are:- Keep your transactions short.
- Check your "isolation level". Some frameworks use the "serializable" isolation - which severely impacts concurrency.
- For reports, consider using "read uncommitted" isolation.
- If your transactions access multiple tables then try to update tables in the same sequence.
Hope that helps. This artical[^] may help.
Regards
Andy
|
|
|
|
|
|
ma se wrote: AND tblProduct.Status = 1
should be changed to
WHERE tblProduct.Status = 1
SG
|
|
|
|
|
Hi
ma se wrote: AND tblProduct.Status = 1
Remove it and add it in where clause.
Harini
|
|
|
|
|
Don't delete the original question - It is rude and does not help people that may have a similar problem and are searching the forum.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
hi ,
i want to make table hints for fastfirstrow what is the syntax for the same
|
|
|
|
|
select x, y from a
order by x
option (fastfirstrow)
Note that the "option(fast n)" is preferred under SQL2000 (where "n" is the number of rows).
|
|
|
|
|
Hi I am new to database design and I would like your opinions on my database. I am creating a database to hold website member info. In my register page I ask users who wish to become members to supply the following infos.
First Name, Last Name, Profession, Address, City, State, Zip, Phone Number, Email, User Name, Password
From the info above, I've created a database called Members, a table called Users, and another table called ContactInfo.
Users ContactInfo
_______________ ___________________
|UserID | |Email |
_______________ ___________________
|Email | |Phone |
_______________ ___________________
|FirstName | |Address |
_______________ ___________________
|LastName | |City |
_______________ ___________________
|UserName | |State |
_______________ ___________________
|Password | |Zip |
_______________ ___________________
Do you see any problem with the above database? Please point out any problems that you see. Thank you in advance for your help.
-- modified at 3:43 Monday 11th June, 2007
|
|
|
|
|
The two tables aren't linked to each other. How will you retrieve user's contact info given his/her userID?
|
|
|
|
|
Hi
1. Why two tables?
2. Are you storing more than 1 record in ContactInfo table for a particular user?
3. If you are storing more than 1 contact Info, link should be maintained between those two tables. Users table should have one more column i.e., UserID to maintain unique row. This column should be added to ContactInfo Table so that you can retrieve contact details based on UserID.
See definitions of Normalization for more information. There are three normal forms in database design.
For best example, have a look at Orders and Order Details tables of Northwind database and check the common column between these two table.
Harini
|
|
|
|
|
hi,
Database is correct use userid for relation more than email id.
it is preferable in database.
k.ravi sankar
|
|
|
|
|