Thursday, March 29, 2012
Advice on SQL statement please.
filtered I get the sum of an amount Group By the type. What I would like to
do is use the exact qry using a differnet date, to generate a third column
called Prior12Mnths. How would I use my qry to accomplish this task.
I appreciate the help.
Here's my qry:
Select GroupType, Sum(SumRevAmt) as Last12Mnths
from MyQRY
Where Period = '200006'
Group by GroupType
Type Last12Mnths_200006 Prior12Mnths_199906
Airlines 1234.50 '
Concessions 73854.00 '
etc......Russell Verdun wrote:
> I have a query that generates the dataset below, based on the year being
> filtered I get the sum of an amount Group By the type. What I would like t
o
> do is use the exact qry using a differnet date, to generate a third column
> called Prior12Mnths. How would I use my qry to accomplish this task.
> I appreciate the help.
> Here's my qry:
> Select GroupType, Sum(SumRevAmt) as Last12Mnths
> from MyQRY
> Where Period = '200006'
> Group by GroupType
>
>
> Type Last12Mnths_200006 Prior12Mnths_199906
> Airlines 1234.50 '?
?
> Concessions 73854.00 '
> etc......
>
>
It's not clear from your example what this "other date" would be, so
I'll use a different example. Say I have a table containing
transactions, and each transaction consists of an account, a transaction
date, and an amount:
SELECT
account,
SUM(CASE WHEN DATEDIFF(m, transdate, GETDATE()) <= 12 THEN amount
ELSE 0) AS Last12Months,
SUM(CASE WHEN DATEDIFF(m, transdate, GETDATE()) BETWEEN 13 AND 24
THEN amount ELSE 0) AS Prev12Months
FROM table
GROUP BY account
Is that enough to get you started?|||Tracy McKibben wrote:
> Russell Verdun wrote:
> It's not clear from your example what this "other date" would be, so
> I'll use a different example. Say I have a table containing
> transactions, and each transaction consists of an account, a transaction
> date, and an amount:
> SELECT
> account,
> SUM(CASE WHEN DATEDIFF(m, transdate, GETDATE()) <= 12 THEN amount
> ELSE 0) AS Last12Months,
> SUM(CASE WHEN DATEDIFF(m, transdate, GETDATE()) BETWEEN 13 AND 24
> THEN amount ELSE 0) AS Prev12Months
> FROM table
> GROUP BY account
> Is that enough to get you started?
>
Sorry, those CASE statements are missing ENDs...|||Hi Russell,
I believe you could do something like this:
Select GroupType, Sum(CASE Period=200006 THEN SumRevAmt ELSE 0 END) as
Last12Mnths, Sum(CASE Period=199906 THEN SumRevAmt ELSE 0 END) as
Prior12Mnths
from MyQRY
Where Period = '200006' or Period = '199906'
Group by GroupType
I Dont know if thats the best way, but that is what first comes to
mind.
Paul T.|||>> I have a query that generates the dataset below, based on the year being
filtered I get the sum of an amount Group By the type. What I would like to
do is use the exact qry using a differnet date, to generate a third column
called Prior12Mnths. <<
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is also helpful if the data elements have good
names.
CREATE TABLE Revenues -- guess at meaningful name
(grp_type INTEGER NOT NULL
REFERENCES GroupTypes(grp_type),
rev_amt DECIMAL(12,2) NOT NULL,
rev_date DATETIME NOT NULL PRIMARY KEY);
In the vague pseudo-code you posted, only some kind of vague date can
be a key
The best trick for this kind of summary is to build a reporting range
table
CREATE TABLE ReportRanges
(range_name CHAR() NOT NULL,
start_date DATETIME NOT NULL,
end_date DATETIME NOT NULL,
CHECK (start_date < end_date),
PRIMARY KEY (range_name, start_date));
INSERT INTO ReportRanges
VALUES ('2006-06: Prior12' , '2005-06-01', '2006-06-31' );
INSERT INTO ReportRanges
VALUES ('2006-06: ytd' , '2006-01-01', '2006-06-31' );
SELECT grp_type,
SUM (CASE WHEN R.range_name = '2006-06: ytd'
THEN rev_amt ELSE 0.00 END) AS ytd,
SUM (CASE WHEN R.range_name = '2006-06: Prior12'
THEN rev_amt ELSE 0.00 END) AS Prior12,
etc.
FROM Revenues
GROUP BY grp_type;
Adjust the table as needed.
Sunday, March 25, 2012
Advice
stores in my database ICONS. The application is using the
data type SQL_VARIANT. Was wondering, is sql_variant "ok"
to use... is there anything better... how about pointers?
Can anyone give me some advice on this...
ThanxsIf you by icons mean images (pictures), then I guess you should be using the
image datatype or varbinary. Only
use sql_variant if you really need *different* underlying datatypes for each
row. I've never had to use
sql_variant, btw.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Claudia" <anonymous@.discussions.microsoft.com> wrote in message
news:1696601c4172c$9b93c890$a101280a@.phx
.gbl...
> I have an application that connects to my database and
> stores in my database ICONS. The application is using the
> data type SQL_VARIANT. Was wondering, is sql_variant "ok"
> to use... is there anything better... how about pointers?
> Can anyone give me some advice on this...
> Thanxs
Tuesday, March 20, 2012
Advantages/Disadvantages of TEXT Column type in SQL 2005
I know this question has been asked before, but I'd like to get the
opinions from others before I continue with my database. I am creating
a Database to track calls for a Tech Support dept. There are some
tables like tb_Call, tb_Ticket where I need to allow a user to enter a
long description if necessary. I am thinking of using the Text Field
type with a leght of 16. My question is what are the
advantages/di
vantages with this as opposed to using any other datatype. Any insight or recommendations you can provide will be greatly
appreciated!
Thanks in advance!The TEXT datatype is deprecated in SQL Server 2005. So do not use it for
any new work. Instead, use VARCHAR(MAX) -- that datatype has the same
maximum storage capacity as TEXT, and is a lot more flexible in terms of
being able to use string functions.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Ed_p" <edp@.nomail.com> wrote in message
news:utvCvDY6FHA.1248@.TK2MSFTNGP14.phx.gbl...
> Hello,
> I know this question has been asked before, but I'd like to get the
> opinions from others before I continue with my database. I am creating a
> Database to track calls for a Tech Support dept. There are some tables
> like tb_Call, tb_Ticket where I need to allow a user to enter a long
> description if necessary. I am thinking of using the Text Field type with
> a leght of 16. My question is what are the advantages/di
vantages with> this as opposed to using any other data type. Any insight or
> recommendations you can provide will be greatly appreciated!
> Thanks in advance!|||
Adam Machanic wrote:
>The TEXT datatype is deprecated in SQL Server 2005. So do not use it for
>any new work. Instead, use VARCHAR(MAX) -- that datatype has the same
>maximum storage capacity as TEXT, and is a lot more flexible in terms of
>being able to use string functions.
>
>
It's worth noting that while for [text] the default is
to store data out-of-row, for the (max) types, the
default is to store data in-row. In some cases, this
can make a difference, and it may be useful to set the
table option so that the (max) type behaves like [text]
did:
exec sp_tableoption N'MyTable', 'large value types out of row', 'ON'
Steve Kass
Drew University|||In addition to the other posts, if you have several such columns, where each
will fit inside the
regular varchar or nvarchar limit: In 2005, you have page overflow, meaning
you can have for
instance two varchar(5000) each containing 5000 characters.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ed_p" <edp@.nomail.com> wrote in message news:utvCvDY6FHA.1248@.TK2MSFTNGP14.phx.gbl...[colo
r=darkred]
> Hello,
> I know this question has been asked before, but I'd like to get the opinio
ns from others before I
> continue with my database. I am creating a Database to track calls for a
Tech Support dept.
> There are some tables like tb_Call, tb_Ticket where I need to allow a user
to enter a long
> description if necessary. I am thinking of using the Text Field type with
a leght of 16. My
> question is what are the advantages/di
vantages with this as opposed to using any other data
> type. Any insight or recommendations you can provide will be greatly appr
eciated!
> Thanks in advance![/color]
Advantages of Table variables over Temp tables
temporary table. Isn't the data stored in the temp db in the case of
table type variables? if not, where is the data stored?An article on this here:
http://www.aspfaq.com/show.asp?id=2475
David Portas
SQL Server MVP
--|||You can read following article written by Mike Gunderloy, describing
usage and advantages with respect to Table variable and temporary
tables.
<http://developer.com/db/article.php/10920_3414331_1>
-Hari Sharma
India|||http://toponewithties.blogspot.com/...nd.h
tml
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com
<balacr@.gmail.com> wrote in message
news:1127109967.631131.113870@.g14g2000cwa.googlegroups.com...
> What are the advantages of using a table type variables over a
> temporary table. Isn't the data stored in the temp db in the case of
> table type variables? if not, where is the data stored?
>
Sunday, March 11, 2012
Advanced Expression?
amounts based on a record type. If FieldType = 1 to sum accounts in a range
otherwise to sum all records with that account. The result is an error
[BC30201] Expression expected. The formula I have so far is:
=iif( Fields!FieldType.Value = 1, select sum( Fields!amount.Value) from
db.owner.table with (nolock) where Fields!account between
Fields!fromaccount.Value and Fields!toaccount.Value ,Sum(Fields!amount.Value))
I've also tried VB's Select/Case statement rather than IIF but it still
returns an error.
If this can't be done with expressions, can it be done someother way?
Thanks,
RickThis seems you might want to try creating a stored procedure and using the sp
as the basis of your report, not trying to calc that in a report cell. You
can't use a select statement from within the iif statement.
"rickp3131" wrote:
> I'm creating a report that looks through detail records and want it to sum
> amounts based on a record type. If FieldType = 1 to sum accounts in a range
> otherwise to sum all records with that account. The result is an error
> [BC30201] Expression expected. The formula I have so far is:
> =iif( Fields!FieldType.Value = 1, select sum( Fields!amount.Value) from
> db.owner.table with (nolock) where Fields!account between
> Fields!fromaccount.Value and Fields!toaccount.Value ,Sum(Fields!amount.Value))
> I've also tried VB's Select/Case statement rather than IIF but it still
> returns an error.
> If this can't be done with expressions, can it be done someother way?
> Thanks,
> Rick|||Mike,
Thanks for your reply. Are you referring to creating a stored procedure in
SQL or does RS have the ability to create stored procedures as well, like in
Report properties.custom code?
Since my post I came to the same conclusion you mention that what I'm trying
to do won't work in the reporting cell so I've been looking into creating a
function using custom code but as you mention, the select statement can't be
used within IIF. Can a stored procedure be called from IIF?
As a general custom code question, can C as well as VB code be used?
Thanks again!
Rick
"mike" wrote:
> This seems you might want to try creating a stored procedure and using the sp
> as the basis of your report, not trying to calc that in a report cell. You
> can't use a select statement from within the iif statement.
> "rickp3131" wrote:
> > I'm creating a report that looks through detail records and want it to sum
> > amounts based on a record type. If FieldType = 1 to sum accounts in a range
> > otherwise to sum all records with that account. The result is an error
> > [BC30201] Expression expected. The formula I have so far is:
> >
> > =iif( Fields!FieldType.Value = 1, select sum( Fields!amount.Value) from
> > db.owner.table with (nolock) where Fields!account between
> > Fields!fromaccount.Value and Fields!toaccount.Value ,Sum(Fields!amount.Value))
> >
> > I've also tried VB's Select/Case statement rather than IIF but it still
> > returns an error.
> >
> > If this can't be done with expressions, can it be done someother way?
> >
> > Thanks,
> > Rick|||You can try an SQL user defined function returning a table with summary
details, then use the IIF statement to get more specific, or you can use a
"Where" statement in your dataset
"rickp3131" wrote:
> I'm creating a report that looks through detail records and want it to sum
> amounts based on a record type. If FieldType = 1 to sum accounts in a range
> otherwise to sum all records with that account. The result is an error
> [BC30201] Expression expected. The formula I have so far is:
> =iif( Fields!FieldType.Value = 1, select sum( Fields!amount.Value) from
> db.owner.table with (nolock) where Fields!account between
> Fields!fromaccount.Value and Fields!toaccount.Value ,Sum(Fields!amount.Value))
> I've also tried VB's Select/Case statement rather than IIF but it still
> returns an error.
> If this can't be done with expressions, can it be done someother way?
> Thanks,
> Rick
Thursday, March 8, 2012
Adult Content Filter
Does anyone have suggestions on the best way to run through a particular block of text, searching if an offensive word was present and then omitting the post?
Obviousily the front end would be a web app, but the back end dbase for this is M$ SQL Server 2000.
Any ideas or comments would be appreciated!U need a dictionary in your database, and a fulltext search engine to deal with the posted text, to find if the words in the dictionary appear in the text, and also the count of them. Then to decide if the text is clean.|||I would look to perl, ruby, or python for this solution. Perl handles strings very well and would be a natural for this task. You could do this on your web server and reject the post or give the author a chance to correct the indiscretion if there was a problem.|||Paul,
The webserver is running Win2K and IIS 5.0. Do you think some ASP code would work? What would be the most effiecient place for it to process? Client, Webserver or DBase side?
Thanks for the response.|||First of, I am NOT a WEB developer so I may not be the best person to answer this question.
The way I see this problem is you need to take a list of words and pass them over some text to see if you get a match. This does not sound like something a DB could do efficiently. I am 100% posative I could setup a DB solution in less than a day but I suspect that using Perl and Regulare Expresions would be a better answer. If you haven't used Perl or RegEx. both excel at string manipulation.
As for running the code on the client or web server, I personaly would choose the web server. It seems like the deployment and maintinance would be simplified.|||Thanks for the info. I will post with the solution I come up with. Then maybe some has some ideas on whether they can come up with something better!
Thanks again.
Saturday, February 25, 2012
ADODB Connection Error.
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
/visastatus/NewEmpVisaDetails.asp, line 35
Even registering the dll "sqloledb.dll" didn't fix the problem. Added to
it...
The Enterprise Manager is giving an error " Provider cannot be found. It may
not be properly installed."
Do let me know the fix, i have reinstalled the SQL 2000, the fix given by
the system support people is to reformat my system.
Arun
--
"Knowledge grows when Shared"
- AnonymousWhat does your connection string look like? It will probably have the word
provider in it.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> Error Type:
> ADODB.Connection (0x800A0E7A)
> Provider cannot be found. It may not be properly installed.
> /visastatus/NewEmpVisaDetails.asp, line 35
> Even registering the dll "sqloledb.dll" didn't fix the problem. Added to
> it...
> The Enterprise Manager is giving an error " Provider cannot be found. It
> may
> not be properly installed."
> Do let me know the fix, i have reinstalled the SQL 2000, the fix given by
> the system support people is to reformat my system.
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous|||Hi
You may want to check MDAC is installed correctly see the component checker
http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
John
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> Error Type:
> ADODB.Connection (0x800A0E7A)
> Provider cannot be found. It may not be properly installed.
> /visastatus/NewEmpVisaDetails.asp, line 35
> Even registering the dll "sqloledb.dll" didn't fix the problem. Added to
> it...
> The Enterprise Manager is giving an error " Provider cannot be found. It
> may
> not be properly installed."
> Do let me know the fix, i have reinstalled the SQL 2000, the fix given by
> the system support people is to reformat my system.
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous|||Cotter
Yep ur right it does house the word Provider in the connection, but i was
able to establish the connection previously.
Would that affect my enterprise manager too, even when i right click on a
table and when i choose return all rows it is giving me a "Provider...not
installed".
Rather it is a problem with the SQL(Enterprise manager) rather than the
connection string...(Guess so!), if not let me know how do i modify the
connection string.
Here is how my connection string looks
set objConn=Server.CreateObject("ADODB.CONNECTION")
objConn.Open "Provider=SQLOLEDB;data Source=<my server>;Initial Catalog=<my
database>;User Id= <id> ;Password= pwd"
"Knowledge grows when Shared"
- Anonymous
"Hilary Cotter" wrote:
> What does your connection string look like? It will probably have the word
> provider in it.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> > Error Type:
> > ADODB.Connection (0x800A0E7A)
> > Provider cannot be found. It may not be properly installed.
> > /visastatus/NewEmpVisaDetails.asp, line 35
> >
> > Even registering the dll "sqloledb.dll" didn't fix the problem. Added to
> > it...
> >
> > The Enterprise Manager is giving an error " Provider cannot be found. It
> > may
> > not be properly installed."
> >
> > Do let me know the fix, i have reinstalled the SQL 2000, the fix given by
> > the system support people is to reformat my system.
> >
> > Arun
> >
> > --
> > "Knowledge grows when Shared"
> > - Anonymous
>
>|||John
I have already installed Component Checker, do let me know where do i find
the error, educate me how to use it for trouble shooting.
Arun
--
"Knowledge grows when Shared"
- Anonymous
"John Bell" wrote:
> Hi
> You may want to check MDAC is installed correctly see the component checker
> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
> John
> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> > Error Type:
> > ADODB.Connection (0x800A0E7A)
> > Provider cannot be found. It may not be properly installed.
> > /visastatus/NewEmpVisaDetails.asp, line 35
> >
> > Even registering the dll "sqloledb.dll" didn't fix the problem. Added to
> > it...
> >
> > The Enterprise Manager is giving an error " Provider cannot be found. It
> > may
> > not be properly installed."
> >
> > Do let me know the fix, i have reinstalled the SQL 2000, the fix given by
> > the system support people is to reformat my system.
> >
> > Arun
> >
> > --
> > "Knowledge grows when Shared"
> > - Anonymous
>
>|||Hi
If you run the component checker it will show you the dlls installed and
what version they are at. If you are at a version less than 2.8 SP1 then you
may want to consider trying an upgrade.
John
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
> John
> I have already installed Component Checker, do let me know where do i find
> the error, educate me how to use it for trouble shooting.
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous
>
> "John Bell" wrote:
>> Hi
>> You may want to check MDAC is installed correctly see the component
>> checker
>> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
>> John
>> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
>> > Error Type:
>> > ADODB.Connection (0x800A0E7A)
>> > Provider cannot be found. It may not be properly installed.
>> > /visastatus/NewEmpVisaDetails.asp, line 35
>> >
>> > Even registering the dll "sqloledb.dll" didn't fix the problem. Added
>> > to
>> > it...
>> >
>> > The Enterprise Manager is giving an error " Provider cannot be found.
>> > It
>> > may
>> > not be properly installed."
>> >
>> > Do let me know the fix, i have reinstalled the SQL 2000, the fix given
>> > by
>> > the system support people is to reformat my system.
>> >
>> > Arun
>> >
>> > --
>> > "Knowledge grows when Shared"
>> > - Anonymous
>>|||I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
What else could be the problem...!!!
Arun
--
"Knowledge grows when Shared"
- Anonymous
"John Bell" wrote:
> Hi
> If you run the component checker it will show you the dlls installed and
> what version they are at. If you are at a version less than 2.8 SP1 then you
> may want to consider trying an upgrade.
> John
> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
> > John
> >
> > I have already installed Component Checker, do let me know where do i find
> > the error, educate me how to use it for trouble shooting.
> >
> > Arun
> > --
> > "Knowledge grows when Shared"
> > - Anonymous
> >
> >
> > "John Bell" wrote:
> >
> >> Hi
> >>
> >> You may want to check MDAC is installed correctly see the component
> >> checker
> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
> >>
> >> John
> >>
> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> >> > Error Type:
> >> > ADODB.Connection (0x800A0E7A)
> >> > Provider cannot be found. It may not be properly installed.
> >> > /visastatus/NewEmpVisaDetails.asp, line 35
> >> >
> >> > Even registering the dll "sqloledb.dll" didn't fix the problem. Added
> >> > to
> >> > it...
> >> >
> >> > The Enterprise Manager is giving an error " Provider cannot be found.
> >> > It
> >> > may
> >> > not be properly installed."
> >> >
> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix given
> >> > by
> >> > the system support people is to reformat my system.
> >> >
> >> > Arun
> >> >
> >> > --
> >> > "Knowledge grows when Shared"
> >> > - Anonymous
> >>
> >>
> >>
>
>|||The component checker will usually detect problems with installed
components. You might try reinstalling the MDAC 2.8 SP1.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
> I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
> What else could be the problem...!!!
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous
>
> "John Bell" wrote:
>> Hi
>> If you run the component checker it will show you the dlls installed and
>> what version they are at. If you are at a version less than 2.8 SP1 then
>> you
>> may want to consider trying an upgrade.
>> John
>> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
>> > John
>> >
>> > I have already installed Component Checker, do let me know where do i
>> > find
>> > the error, educate me how to use it for trouble shooting.
>> >
>> > Arun
>> > --
>> > "Knowledge grows when Shared"
>> > - Anonymous
>> >
>> >
>> > "John Bell" wrote:
>> >
>> >> Hi
>> >>
>> >> You may want to check MDAC is installed correctly see the component
>> >> checker
>> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
>> >>
>> >> John
>> >>
>> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
>> >> > Error Type:
>> >> > ADODB.Connection (0x800A0E7A)
>> >> > Provider cannot be found. It may not be properly installed.
>> >> > /visastatus/NewEmpVisaDetails.asp, line 35
>> >> >
>> >> > Even registering the dll "sqloledb.dll" didn't fix the problem.
>> >> > Added
>> >> > to
>> >> > it...
>> >> >
>> >> > The Enterprise Manager is giving an error " Provider cannot be
>> >> > found.
>> >> > It
>> >> > may
>> >> > not be properly installed."
>> >> >
>> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix
>> >> > given
>> >> > by
>> >> > the system support people is to reformat my system.
>> >> >
>> >> > Arun
>> >> >
>> >> > --
>> >> > "Knowledge grows when Shared"
>> >> > - Anonymous
>> >>
>> >>
>> >>
>>|||Forgive me i have done that 2...reinstalled the SQL, MDAC 2.8, but nothing is
happening.
I wouldn't want to c my system getting formatted for this system...some1
HELP!!!!
Arun
--
"Knowledge grows when Shared"
- Anonymous
"Dan Guzman" wrote:
> The component checker will usually detect problems with installed
> components. You might try reinstalling the MDAC 2.8 SP1.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
> > I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
> >
> > What else could be the problem...!!!
> >
> > Arun
> > --
> > "Knowledge grows when Shared"
> > - Anonymous
> >
> >
> > "John Bell" wrote:
> >
> >> Hi
> >>
> >> If you run the component checker it will show you the dlls installed and
> >> what version they are at. If you are at a version less than 2.8 SP1 then
> >> you
> >> may want to consider trying an upgrade.
> >>
> >> John
> >>
> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
> >> > John
> >> >
> >> > I have already installed Component Checker, do let me know where do i
> >> > find
> >> > the error, educate me how to use it for trouble shooting.
> >> >
> >> > Arun
> >> > --
> >> > "Knowledge grows when Shared"
> >> > - Anonymous
> >> >
> >> >
> >> > "John Bell" wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> You may want to check MDAC is installed correctly see the component
> >> >> checker
> >> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
> >> >>
> >> >> John
> >> >>
> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> >> >> > Error Type:
> >> >> > ADODB.Connection (0x800A0E7A)
> >> >> > Provider cannot be found. It may not be properly installed.
> >> >> > /visastatus/NewEmpVisaDetails.asp, line 35
> >> >> >
> >> >> > Even registering the dll "sqloledb.dll" didn't fix the problem.
> >> >> > Added
> >> >> > to
> >> >> > it...
> >> >> >
> >> >> > The Enterprise Manager is giving an error " Provider cannot be
> >> >> > found.
> >> >> > It
> >> >> > may
> >> >> > not be properly installed."
> >> >> >
> >> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix
> >> >> > given
> >> >> > by
> >> >> > the system support people is to reformat my system.
> >> >> >
> >> >> > Arun
> >> >> >
> >> >> > --
> >> >> > "Knowledge grows when Shared"
> >> >> > - Anonymous
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||It's strange that the component checker didn't detect an error so server
that both ODBC and SQLOLEDB providers are not found. Do all components
match? Did you reboot after the MDAC reinstall?
Just to be clear, if SQL Server and your application are running on a
different machines, you should be focusing on the client box rather than the
database server.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:C4D95659-D871-4939-9BE3-45631F8AA1B7@.microsoft.com...
> Forgive me i have done that 2...reinstalled the SQL, MDAC 2.8, but nothing
> is
> happening.
> I wouldn't want to c my system getting formatted for this system...some1
> HELP!!!!
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous
>
> "Dan Guzman" wrote:
>> The component checker will usually detect problems with installed
>> components. You might try reinstalling the MDAC 2.8 SP1.
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
>> > I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
>> >
>> > What else could be the problem...!!!
>> >
>> > Arun
>> > --
>> > "Knowledge grows when Shared"
>> > - Anonymous
>> >
>> >
>> > "John Bell" wrote:
>> >
>> >> Hi
>> >>
>> >> If you run the component checker it will show you the dlls installed
>> >> and
>> >> what version they are at. If you are at a version less than 2.8 SP1
>> >> then
>> >> you
>> >> may want to consider trying an upgrade.
>> >>
>> >> John
>> >>
>> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
>> >> > John
>> >> >
>> >> > I have already installed Component Checker, do let me know where do
>> >> > i
>> >> > find
>> >> > the error, educate me how to use it for trouble shooting.
>> >> >
>> >> > Arun
>> >> > --
>> >> > "Knowledge grows when Shared"
>> >> > - Anonymous
>> >> >
>> >> >
>> >> > "John Bell" wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> You may want to check MDAC is installed correctly see the component
>> >> >> checker
>> >> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
>> >> >>
>> >> >> John
>> >> >>
>> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
>> >> >> > Error Type:
>> >> >> > ADODB.Connection (0x800A0E7A)
>> >> >> > Provider cannot be found. It may not be properly installed.
>> >> >> > /visastatus/NewEmpVisaDetails.asp, line 35
>> >> >> >
>> >> >> > Even registering the dll "sqloledb.dll" didn't fix the problem.
>> >> >> > Added
>> >> >> > to
>> >> >> > it...
>> >> >> >
>> >> >> > The Enterprise Manager is giving an error " Provider cannot be
>> >> >> > found.
>> >> >> > It
>> >> >> > may
>> >> >> > not be properly installed."
>> >> >> >
>> >> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix
>> >> >> > given
>> >> >> > by
>> >> >> > the system support people is to reformat my system.
>> >> >> >
>> >> >> > Arun
>> >> >> >
>> >> >> > --
>> >> >> > "Knowledge grows when Shared"
>> >> >> > - Anonymous
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>|||Hi
Can you confirm that other workstations are working ok?
You may want to try re-installing the client tools.
John
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:C4D95659-D871-4939-9BE3-45631F8AA1B7@.microsoft.com...
> Forgive me i have done that 2...reinstalled the SQL, MDAC 2.8, but nothing
> is
> happening.
> I wouldn't want to c my system getting formatted for this system...some1
> HELP!!!!
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous
>
> "Dan Guzman" wrote:
>> The component checker will usually detect problems with installed
>> components. You might try reinstalling the MDAC 2.8 SP1.
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
>> > I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
>> >
>> > What else could be the problem...!!!
>> >
>> > Arun
>> > --
>> > "Knowledge grows when Shared"
>> > - Anonymous
>> >
>> >
>> > "John Bell" wrote:
>> >
>> >> Hi
>> >>
>> >> If you run the component checker it will show you the dlls installed
>> >> and
>> >> what version they are at. If you are at a version less than 2.8 SP1
>> >> then
>> >> you
>> >> may want to consider trying an upgrade.
>> >>
>> >> John
>> >>
>> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
>> >> > John
>> >> >
>> >> > I have already installed Component Checker, do let me know where do
>> >> > i
>> >> > find
>> >> > the error, educate me how to use it for trouble shooting.
>> >> >
>> >> > Arun
>> >> > --
>> >> > "Knowledge grows when Shared"
>> >> > - Anonymous
>> >> >
>> >> >
>> >> > "John Bell" wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> You may want to check MDAC is installed correctly see the component
>> >> >> checker
>> >> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
>> >> >>
>> >> >> John
>> >> >>
>> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
>> >> >> > Error Type:
>> >> >> > ADODB.Connection (0x800A0E7A)
>> >> >> > Provider cannot be found. It may not be properly installed.
>> >> >> > /visastatus/NewEmpVisaDetails.asp, line 35
>> >> >> >
>> >> >> > Even registering the dll "sqloledb.dll" didn't fix the problem.
>> >> >> > Added
>> >> >> > to
>> >> >> > it...
>> >> >> >
>> >> >> > The Enterprise Manager is giving an error " Provider cannot be
>> >> >> > found.
>> >> >> > It
>> >> >> > may
>> >> >> > not be properly installed."
>> >> >> >
>> >> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix
>> >> >> > given
>> >> >> > by
>> >> >> > the system support people is to reformat my system.
>> >> >> >
>> >> >> > Arun
>> >> >> >
>> >> >> > --
>> >> >> > "Knowledge grows when Shared"
>> >> >> > - Anonymous
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>|||Tried with my neighbours system, found to be working fine. But the error is
ONLY
with my system.
The application is in my system and the database is in different workstation
- DAN this is FYI
Arun
--
"Knowledge grows when Shared"
- Anonymous
"John Bell" wrote:
> Hi
> Can you confirm that other workstations are working ok?
> You may want to try re-installing the client tools.
> John
> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> news:C4D95659-D871-4939-9BE3-45631F8AA1B7@.microsoft.com...
> > Forgive me i have done that 2...reinstalled the SQL, MDAC 2.8, but nothing
> > is
> > happening.
> >
> > I wouldn't want to c my system getting formatted for this system...some1
> > HELP!!!!
> >
> > Arun
> > --
> > "Knowledge grows when Shared"
> > - Anonymous
> >
> >
> > "Dan Guzman" wrote:
> >
> >> The component checker will usually detect problems with installed
> >> components. You might try reinstalling the MDAC 2.8 SP1.
> >>
> >> --
> >> Hope this helps.
> >>
> >> Dan Guzman
> >> SQL Server MVP
> >>
> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
> >> > I'm having MDAC 2.8 SP1...It is giving me the Product Release matches.
> >> >
> >> > What else could be the problem...!!!
> >> >
> >> > Arun
> >> > --
> >> > "Knowledge grows when Shared"
> >> > - Anonymous
> >> >
> >> >
> >> > "John Bell" wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> If you run the component checker it will show you the dlls installed
> >> >> and
> >> >> what version they are at. If you are at a version less than 2.8 SP1
> >> >> then
> >> >> you
> >> >> may want to consider trying an upgrade.
> >> >>
> >> >> John
> >> >>
> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> >> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
> >> >> > John
> >> >> >
> >> >> > I have already installed Component Checker, do let me know where do
> >> >> > i
> >> >> > find
> >> >> > the error, educate me how to use it for trouble shooting.
> >> >> >
> >> >> > Arun
> >> >> > --
> >> >> > "Knowledge grows when Shared"
> >> >> > - Anonymous
> >> >> >
> >> >> >
> >> >> > "John Bell" wrote:
> >> >> >
> >> >> >> Hi
> >> >> >>
> >> >> >> You may want to check MDAC is installed correctly see the component
> >> >> >> checker
> >> >> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
> >> >> >>
> >> >> >> John
> >> >> >>
> >> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
> >> >> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
> >> >> >> > Error Type:
> >> >> >> > ADODB.Connection (0x800A0E7A)
> >> >> >> > Provider cannot be found. It may not be properly installed.
> >> >> >> > /visastatus/NewEmpVisaDetails.asp, line 35
> >> >> >> >
> >> >> >> > Even registering the dll "sqloledb.dll" didn't fix the problem.
> >> >> >> > Added
> >> >> >> > to
> >> >> >> > it...
> >> >> >> >
> >> >> >> > The Enterprise Manager is giving an error " Provider cannot be
> >> >> >> > found.
> >> >> >> > It
> >> >> >> > may
> >> >> >> > not be properly installed."
> >> >> >> >
> >> >> >> > Do let me know the fix, i have reinstalled the SQL 2000, the fix
> >> >> >> > given
> >> >> >> > by
> >> >> >> > the system support people is to reformat my system.
> >> >> >> >
> >> >> >> > Arun
> >> >> >> >
> >> >> >> > --
> >> >> >> > "Knowledge grows when Shared"
> >> >> >> > - Anonymous
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||> The application is in my system and the database is in different
> workstation
> - DAN this is FYI
I just wanted to make sure that you are doing this the client rather than
the server.
I've never run into a situation where an errant MDAC installation wasn't
identified by the component checker. I don't have any other suggestions
other than those already provided.
Unless someone else chimes in, you might take the advise of the system
support people and repave. As painful as that is, it might be the most
expedient solution.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
news:09442D27-7968-42F8-ABC2-D98E9F860374@.microsoft.com...
> Tried with my neighbours system, found to be working fine. But the error
> is
> ONLY
> with my system.
> The application is in my system and the database is in different
> workstation
> - DAN this is FYI
> Arun
> --
> "Knowledge grows when Shared"
> - Anonymous
>
> "John Bell" wrote:
>> Hi
>> Can you confirm that other workstations are working ok?
>> You may want to try re-installing the client tools.
>> John
>> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> news:C4D95659-D871-4939-9BE3-45631F8AA1B7@.microsoft.com...
>> > Forgive me i have done that 2...reinstalled the SQL, MDAC 2.8, but
>> > nothing
>> > is
>> > happening.
>> >
>> > I wouldn't want to c my system getting formatted for this
>> > system...some1
>> > HELP!!!!
>> >
>> > Arun
>> > --
>> > "Knowledge grows when Shared"
>> > - Anonymous
>> >
>> >
>> > "Dan Guzman" wrote:
>> >
>> >> The component checker will usually detect problems with installed
>> >> components. You might try reinstalling the MDAC 2.8 SP1.
>> >>
>> >> --
>> >> Hope this helps.
>> >>
>> >> Dan Guzman
>> >> SQL Server MVP
>> >>
>> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> news:A7F3B556-4CDC-49F9-AAB9-3842A02E1AAF@.microsoft.com...
>> >> > I'm having MDAC 2.8 SP1...It is giving me the Product Release
>> >> > matches.
>> >> >
>> >> > What else could be the problem...!!!
>> >> >
>> >> > Arun
>> >> > --
>> >> > "Knowledge grows when Shared"
>> >> > - Anonymous
>> >> >
>> >> >
>> >> > "John Bell" wrote:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> If you run the component checker it will show you the dlls
>> >> >> installed
>> >> >> and
>> >> >> what version they are at. If you are at a version less than 2.8 SP1
>> >> >> then
>> >> >> you
>> >> >> may want to consider trying an upgrade.
>> >> >>
>> >> >> John
>> >> >>
>> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in message
>> >> >> news:689B1660-DB62-4B85-B63B-7B8CD27F8C94@.microsoft.com...
>> >> >> > John
>> >> >> >
>> >> >> > I have already installed Component Checker, do let me know where
>> >> >> > do
>> >> >> > i
>> >> >> > find
>> >> >> > the error, educate me how to use it for trouble shooting.
>> >> >> >
>> >> >> > Arun
>> >> >> > --
>> >> >> > "Knowledge grows when Shared"
>> >> >> > - Anonymous
>> >> >> >
>> >> >> >
>> >> >> > "John Bell" wrote:
>> >> >> >
>> >> >> >> Hi
>> >> >> >>
>> >> >> >> You may want to check MDAC is installed correctly see the
>> >> >> >> component
>> >> >> >> checker
>> >> >> >> http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&DisplayLang=en
>> >> >> >>
>> >> >> >> John
>> >> >> >>
>> >> >> >> "Arunkumar" <Arunkumar@.discussions.microsoft.com> wrote in
>> >> >> >> message
>> >> >> >> news:41DF7DCA-0843-4635-B61C-3E133B760223@.microsoft.com...
>> >> >> >> > Error Type:
>> >> >> >> > ADODB.Connection (0x800A0E7A)
>> >> >> >> > Provider cannot be found. It may not be properly installed.
>> >> >> >> > /visastatus/NewEmpVisaDetails.asp, line 35
>> >> >> >> >
>> >> >> >> > Even registering the dll "sqloledb.dll" didn't fix the
>> >> >> >> > problem.
>> >> >> >> > Added
>> >> >> >> > to
>> >> >> >> > it...
>> >> >> >> >
>> >> >> >> > The Enterprise Manager is giving an error " Provider cannot be
>> >> >> >> > found.
>> >> >> >> > It
>> >> >> >> > may
>> >> >> >> > not be properly installed."
>> >> >> >> >
>> >> >> >> > Do let me know the fix, i have reinstalled the SQL 2000, the
>> >> >> >> > fix
>> >> >> >> > given
>> >> >> >> > by
>> >> >> >> > the system support people is to reformat my system.
>> >> >> >> >
>> >> >> >> > Arun
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > "Knowledge grows when Shared"
>> >> >> >> > - Anonymous
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
Friday, February 24, 2012
ADO.NET & SELECT ... UNION issue
Hi,
I have discovered something weird.
I prepared a dataset that consists of a table adapter which has a select command of type stored proc. My stored procedure performs a select on a table1 and then table2 using UNION. My stored proc is running perfectly in the SQL Management studio (SQL2005) - no questions.
In Visual Studio when I test my dataset querying my tableadapter I get a result that is not just a UNION but a join of empty columns (number of empty columns = number of columns from one of my tables) and then the result of select statement from my stored proc.
And then my asp.net code fails as well because my gridView is expecting only 3 columns but instead I am getting 6 (3 empty + 3 those I was expecting in the first place.)
I think ADO.NET converted you UNION to a JOIN which either means your table was UNION compatible implicitly or ADO.NET internally is using very old SET operation based JOIN syntax. So check your table to see if it is explicitly UNION compatible, I am assuming you know UNION performs implicit distinct to remove duplicates so its requirements are strict compared to UNION ALL which includes duplicate rows. Hope this helps.
http://msdn2.microsoft.com/en-us/library/ms180026.aspx
|||Hey,
That is exactly what happened. ADO.net converted my resultset to some sort of join and I know why.
The thing that caused that abnormal behavior was I used a join on two tables that have different column names. Once I've changed my select statement in both parts of the union to return exactly the same names of columns it's started working properly.
Monday, February 13, 2012
ADO adDBtimeStamp maps to a DATETIME type in SQL Server
in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
format. This is not I will. One way I thought is converting the
smalldatetime to a string. And this's not a elegant way. Because in
the case, I have to change many sql sentences to fix the problem.
Any suggestion? Thanks in advance.You are correct that date/time formatting should be done in application code
rather than SQL Server so this isn't really a SQL Server question. What
language are you using?
In VbScript, you could do something like:
MyDateTimeString = _
DatePart("yyyy", myDateTime) & "-" & _
Right("0" & DatePart("m", myDateTime), 2) & "-" & _
Right("0" & DatePart("d", myDateTime), 2) & _
" " & _
Right("0" & DatePart("h", myDateTime), 2) & ":" & _
Right("0" & DatePart("n", myDateTime), 2)
In a C#:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm");
In a VB.Net:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm")
--
Hope this helps.
Dan Guzman
SQL Server MVP
<1983ddd@.gmail.com> wrote in message
news:1184992038.598841.62590@.x35g2000prf.googlegroups.com...
>I have a smalldatetime in SQL table, and I want to get this datetime
> in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
> format. This is not I will. One way I thought is converting the
> smalldatetime to a string. And this's not a elegant way. Because in
> the case, I have to change many sql sentences to fix the problem.
> Any suggestion? Thanks in advance.
>
ADO adDBtimeStamp maps to a DATETIME type in SQL Server
in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
format. This is not I will. One way I thought is converting the
smalldatetime to a string. And this's not a elegant way. Because in
the case, I have to change many sql sentences to fix the problem.
Any suggestion? Thanks in advance.
You are correct that date/time formatting should be done in application code
rather than SQL Server so this isn't really a SQL Server question. What
language are you using?
In VbScript, you could do something like:
MyDateTimeString = _
DatePart("yyyy", myDateTime) & "-" & _
Right("0" & DatePart("m", myDateTime), 2) & "-" & _
Right("0" & DatePart("d", myDateTime), 2) & _
" " & _
Right("0" & DatePart("h", myDateTime), 2) & ":" & _
Right("0" & DatePart("n", myDateTime), 2)
In a C#:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm");
In a VB.Net:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm")
Hope this helps.
Dan Guzman
SQL Server MVP
<1983ddd@.gmail.com> wrote in message
news:1184992038.598841.62590@.x35g2000prf.googlegro ups.com...
>I have a smalldatetime in SQL table, and I want to get this datetime
> in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
> format. This is not I will. One way I thought is converting the
> smalldatetime to a string. And this's not a elegant way. Because in
> the case, I have to change many sql sentences to fix the problem.
> Any suggestion? Thanks in advance.
>
ADO adDBtimeStamp maps to a DATETIME type in SQL Server
in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
format. This is not I will. One way I thought is converting the
smalldatetime to a string. And this's not a elegant way. Because in
the case, I have to change many sql sentences to fix the problem.
Any suggestion? Thanks in advance.You are correct that date/time formatting should be done in application code
rather than SQL Server so this isn't really a SQL Server question. What
language are you using?
In VbScript, you could do something like:
MyDateTimeString = _
DatePart("yyyy", myDateTime) & "-" & _
Right("0" & DatePart("m", myDateTime), 2) & "-" & _
Right("0" & DatePart("d", myDateTime), 2) & _
" " & _
Right("0" & DatePart("h", myDateTime), 2) & ":" & _
Right("0" & DatePart("n", myDateTime), 2)
In a C#:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm");
In a VB.Net:
MyDateTimeString = myDateTime.Format("yyyy-MM-dd HH:mm")
Hope this helps.
Dan Guzman
SQL Server MVP
<1983ddd@.gmail.com> wrote in message
news:1184992038.598841.62590@.x35g2000prf.googlegroups.com...
>I have a smalldatetime in SQL table, and I want to get this datetime
> in the format yyyy-mm-dd hh:mm, but acorss ADO, I got yyyy-m-d
> format. This is not I will. One way I thought is converting the
> smalldatetime to a string. And this's not a elegant way. Because in
> the case, I have to change many sql sentences to fix the problem.
> Any suggestion? Thanks in advance.
>