|
I agree with the general consensus. Most likely ToShortDateString() is returning a string representation of a date that SQL Server can't parse.
I would use the formatted ToString() instead:
userDOBFrom = dtUserDOBFrom.AddYears(-userAgeFrom).ToString("yyyy-MM-dd") . This should put it in an ISO standard format that SQL Server should understand, regardless of culture/regional settings.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
I hope you can help me... I store an elapsed time value as a string (varchar) (mm:ss) in my SQL database. When I query the data from Excel, how can I calculate an average from this data? Would it help if I made the SQL datatype some kind of time value?
Thanks in advance for any advice you may provide.
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Jesse Evans wrote:
When I query the data from Excel, how can I calculate an average from this data?
Why are you storing it as a string? I would store it as an integer and if you needed in the format mm:ss a simple calculated field could be created for that function.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
check this
avg(cast(field as int))
|
|
|
|
|
Hi. I can't find the right category for my question so I decided to just post this here.
- Is it possible to use MS Access as a front-end to an Access database (as back-end) that is deployed on the Web Server? My initial reading on this topic seems to imply that I can have MDB as a back end to my front-end application (although this is not highly-recommended for huge applications). However, I need some straight answers to my questions so I posted on this forum.
To access an MDB file on the Web Server, I was told that the front-end application must use a middleware (such as ASP / ASP.NET). And also a capability to send HTTP requests. Does Access has this capability?
I really hope someone could help me with my questions. Thanks very much..
|
|
|
|
|
winpiglet wrote:
To access an MDB file on the Web Server, I was told that the front-end application must use a middleware (such as ASP / ASP.NET). And also a capability to send HTTP requests. Does Access has this capability?
this is true..you need ASP or ASP.NET
And access XP/2003 can help you export reports and forms to ASP.(try right click-export)
|
|
|
|
|
There seems to be a lot of headaches that become apparent on this message board when it comes to topics such as "enforcing database constraints" or "enforcing complex business rules in the database."
I work for a company called Dataphor with a new development tool that not only automates the application development process, but also allows for a declarative approach to enforcement of complex business rules, constraint enforcement, etc.
The product I am speaking of is Dataphor - an automated application environment. By combining the power of a businews rules engine, the automation of a meta-data repository, and the flexibility of a RAD environment, Dataphor provides an unprecendented level of prductivity and maintainability.
Dataphor is a product of Alphora. More information may be found at alphora.com.
-Brady
|
|
|
|
|
On my website I have 3 forms where people enter their contact details (name, email, address, phone and country) and some additional fields which are different for each form. Form 1 requires all the details to be entered, form 2 requires only name, email and country and form 3 requires name, email, address and country.
I initially designed my database with seperate tables for each of the forms since they require different contact details however was wondering whether removing the contact details to a seperate table and leaving some of the columns null would be better.
Can anyone advise me on this?
Thanks
SuzyB
If I had a better memory I would remember more.
|
|
|
|
|
If the common fields will have same data on all the forms, I would create one table for contact details which are nullable, and other individual data into seperate tables and enforce the constriants through application.
Bhaskara
|
|
|
|
|
Hi,
I want to know the primary keys of a given table. I s there any query or procedure which gives the primary keys of a given table in MS SQL.
Karteek
|
|
|
|
|
ADODB::Connection.OpenSchema will probably have something, or ADOX
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Try this
select *
from syscolumns
where id = ( select id from sysobjects where name = 'Table1' )
and colid in ( select distinct keyno from sysindexkeys where id = (select id from sysobjects where name = 'Table1' ) )
Where Table1 is the table name for which you are trying to find Primary Keys
Bhaskara
|
|
|
|
|
Or
If you are using VB.NET or some app, you can use SQLDMO components provided by MS SQL Server and manipulate DB objects, iterate through databases and tables and find out info about DB objects
Bhaskara
|
|
|
|
|
You should never read data straight from the sys... tables. The next service pack you install could completely change their schema/usage.
Instead, try these two queries. Once you see the data, you should be able to figure out how to combine them to meet your needs:
<br />
SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS<br />
SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE<br />
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hi there!
I'd like to create a batch file (*.bat) into which I can place osql calls that will run a couple of stored procedures (in order to create a database or populate some tables, etc.). I have a couple of probs with it:
1. I'd like to only redirect errors into a file. How can this be done? If I use the /o param the complete inputfile gets written out! And how can I suppress those >1 >2 >3... (what do they represent anyway?)
2. Is there a way to do variables in a batch file, which later can be used? It like to create for example a variable holding the username at the top of the *.bat file which I later can reuse when running osql commands.
3. Any samples, better ideas, hints?
Thanks for reading,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
how to create DSN at run time of our database.
Actualy i want that when i deliver the product to user
and he execute the application ..my application
create the DSN of its database ownself..
that is user not build it by using administrative tools in control panel.
i want to do it by CODE .. that i can acces my data base.
any code ,, sample ???
thanx
|
|
|
|
|
DSN is configured in the registry - simple reg key adding & writing fns work ok - look in HKEY_LOCAL_MACHINE\Software\ODBC and you should be able to figure it out
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I cant Get ut point ...
plz send any sample / code line etc.
i wanna make user DSN ...
thanx
|
|
|
|
|
OK - to make a DSN, you need to make some keys in the registry. This can be acheived using the WIN32API function RegCreateKeyEx. (There is probably a simpler method in .NET).
If you open regedit, and navigate to HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.ini , then you will see several keys.
The simplest way to find out what you need to add, is to use the UI to create the DSN that you need, and then look at what it adds to this key. (since different sources need different information). Once you know what needs adding, you can write some code to add the keys.....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I got it ..but cannot build code.
can u send me some code plz
plz at zahid_ash@yahoo.com
thanx
|
|
|
|
|
I need to create a new table in MS Access which has an auto number field as primary key.
Thanks
|
|
|
|
|
in database window :
Select tables
Click new
Design view -> OK
set Fieldname = (your Filed name) and datatype = AutoNumber
click primary key from toolbar.
Save table.
|
|
|
|
|
well actually i needed to do this through a SQL query.
|
|
|
|
|
FASTian wrote:
well actually i needed to do this through a SQL query.
you should tell me
Create table ABC(MyID COUNTER primary key )
|
|
|
|
|
sorry forgot to mention that .....really appreciate your help
thanks
|
|
|
|