Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Thursday, March 29, 2012

Getting the LATEST DATE in the table

How to modify the below procedure in order to get the latest date ( the biggest value ) in the column "Deadline", type smalldatetime, ( example: 24/02/2007 00:00:00 ) for a given customer "UserName" ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CREATE PROCEDURE GetLatestDate

(@.UserName VARCHAR(50)

AS

SELECT Deadline

FROM CustomerItems

WHERE UserName = @.UserName

try

select max(Deadline)from CustomerItemswhere UserName = @.UserName

|||Thank you,jdingo .Smilesql

Tuesday, March 27, 2012

Getting the error "XML stored procedures are not supported in fibers mode"

Hello All
I am getting the error "XML stored procedures are not supported in fibers
mode", when I try to run the example xmlsql given in the SQL books online...
I have changed my "lightweight pooling option to 0", using sp_configure.
I have restarted the server after this.
sp_configure,'show advanced options', 1 will show the lightweight pooling
as 0
But I am still getting the error.
I am using Sql 2000 on windows 2003
Please help. thanks in advance
-rahul
Did you execute the reconfigure command?
This is needed to make the configuration change active.
Best regards
Michael
"RP" <rahulpidaparti@.yahoo.com> wrote in message
news:ODSgBqU2EHA.3244@.TK2MSFTNGP11.phx.gbl...
> Hello All
> I am getting the error "XML stored procedures are not supported in fibers
> mode", when I try to run the example xmlsql given in the SQL books
> online...
> I have changed my "lightweight pooling option to 0", using sp_configure.
> I have restarted the server after this.
> sp_configure,'show advanced options', 1 will show the lightweight
> pooling
> as 0
> But I am still getting the error.
> I am using Sql 2000 on windows 2003
> Please help. thanks in advance
> -rahul
>

Getting the average results based on time.

Hello~,
The table has columns like this.
__
time smalldatetime
value1 int
value2 int
-

for example,
....
'2006-11-16 12:00:00',100,200
'2006-11-16 13:00:00',110,210
'2006-11-16 14:00:00',120,220
....

The record is inserted at every hour.

I want get daily,monthly,yearly average and display the result ordered by time.


SELECT CONVERT(CHAR(8),time,112) as [Day],
AVG(value1) AS value1,
AVG(value2) AS value2
FROM MyTable
GROUP BY CONVERT(CHAR(8),time,112)
ORDER BY 1

SELECT CONVERT(CHAR(6),time,112) as [Month],
AVG(value1) AS value1,
AVG(value2) AS value2
FROM MyTable
GROUP BY CONVERT(CHAR(6),time,112)
ORDER BY 1

SELECT CONVERT(CHAR(4),time,112) as [Year],
AVG(value1) AS value1,
AVG(value2) AS value2
FROM MyTable
GROUP BY CONVERT(CHAR(4),time,112)
ORDER BY 1

sql

Friday, March 23, 2012

getting started 101

hello,

i own about a dozen interactive forums (see example at http://ConcealedCarryForum.com for one of them) that i host on a windows 2000 server dedicated server out of my home on a commercial cable backbone. the forums are ASP using Access DBs. we have outgrown the capabilities of Access and are getting complaints from DB lag during peak usage, and i must upgrade my DB to ensure the QOS end users get from my forums. i have no intention of switching over to php/MySQL/linux formats.

i tried unsuccessfully to get MySQL to play nicely in a windows environment, and recently learned that MSSQL offers free versions, the compact and the express. trouble is, i know absolutely nothing about DB management. Access is idiot proof so i have used it as long as i could. now i find myself in a scramble to learn how to create, employ, and use a more powerful DB.

for my intended usage (running about a dozen DBs on a dedicated server), will compact or express be the appropriate version to start learning? for my intended usage, is there any benefit to downloading/installing/learning the additional tools that are also available? if so, which tools? where do i learn how to create new DBs, and what tools do i need to do this? most tech papers ive seen on MSSQL assume a prior working knowledge of MSSQL DB management and im coming into this completely ignorant but willing to dedicate myself to learning.

answers, advice, etc. very much appreciated.

SQL Server Express should be your best pick (if the volume of the database increases you can easily update to any non-free version of SQL Server). SQL Server Compact edition is a inproc running database which does no need to be installed on the Server. SQL Server Express uses a Service running on the database server, if you are able to install services or use existing on your web server this option should be fine for you. SQL Express is not harder to learn than Access, see the following liknk to get an impression of the features and to get your feet wet:

http://msdn.microsoft.com/vstudio/express/sql/learning/default.aspx

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

thank you, this is exactly what i was looking for. any idea how many simultaneous connections MSSQL express can handle? i know Access handles 20.

thanks again,

|||

There is no technical limit to the number of connection that SQL Express can handle. SQL Express has the following limitations:

1 GB of memory

1 Processor socket

4 GB of user data per database

getting started 101

hello,

i own about a dozen interactive forums (see example at http://ConcealedCarryForum.com for one of them) that i host on a windows 2000 server dedicated server out of my home on a commercial cable backbone. the forums are ASP using Access DBs. we have outgrown the capabilities of Access and are getting complaints from DB lag during peak usage, and i must upgrade my DB to ensure the QOS end users get from my forums. i have no intention of switching over to php/MySQL/linux formats.

i tried unsuccessfully to get MySQL to play nicely in a windows environment, and recently learned that MSSQL offers free versions, the compact and the express. trouble is, i know absolutely nothing about DB management. Access is idiot proof so i have used it as long as i could. now i find myself in a scramble to learn how to create, employ, and use a more powerful DB.

for my intended usage (running about a dozen DBs on a dedicated server), will compact or express be the appropriate version to start learning? for my intended usage, is there any benefit to downloading/installing/learning the additional tools that are also available? if so, which tools? where do i learn how to create new DBs, and what tools do i need to do this? most tech papers ive seen on MSSQL assume a prior working knowledge of MSSQL DB management and im coming into this completely ignorant but willing to dedicate myself to learning.

answers, advice, etc. very much appreciated.

SQL Server Express should be your best pick (if the volume of the database increases you can easily update to any non-free version of SQL Server). SQL Server Compact edition is a inproc running database which does no need to be installed on the Server. SQL Server Express uses a Service running on the database server, if you are able to install services or use existing on your web server this option should be fine for you. SQL Express is not harder to learn than Access, see the following liknk to get an impression of the features and to get your feet wet:

http://msdn.microsoft.com/vstudio/express/sql/learning/default.aspx

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

thank you, this is exactly what i was looking for. any idea how many simultaneous connections MSSQL express can handle? i know Access handles 20.

thanks again,

|||

There is no technical limit to the number of connection that SQL Express can handle. SQL Express has the following limitations:

1 GB of memory

1 Processor socket

4 GB of user data per database

Wednesday, March 21, 2012

getting second row of the table

Hi Everyone,

I want to get the second row of the table. is it possible to get that through a query. For example I have a table

Table A

col1 col2 col3

west east North
hat get mouse


I only want the second row of the table. i don't want the first row. I don't want any other rows. Please let me know if it is possible to do that and how.

Thanks.

You will need to define what you mean by "second row". SQL Server does not store records sequentially, so "second row" really has no meaning unless you specify an ORDER BY in your query.sql

Friday, March 9, 2012

Getting names from RID: db_id:file_id:page_no:row_no

Is there any way to retrieve table name and record data from RID:
db_id:file_id:page_no:row_no, for example,
RID: 1:1:1253:0 in my program?
Please reply me. Thanks in advance.
Regards,
Hyun-jik BaeYou may use the DBCC PAGE statement (undocumented). See:
http://www.sqlservercentral.com/col...ngdeadlocks.asp
http://www.microsoft.com/technet/pr...ks/inside6.mspx
Razvan

Friday, February 24, 2012

Getting field info from subreport

Quick question...
I have a report with a subreport. Can I reference a field/textbox in the
subreport from the main report? For example, if I have a sum calculated by
the subreport, can I display that in the report?
Thanks!hi!
you can't reference a value from SubReport in Report directly, but you can
sent this value as a parameter to a Report
1. In Subreport Set a link to main Report
1.1 Inb the Subreport select textBox or field in the table
1.2 select navigation tab of property
1.3 select "jump to Report" and chose your Main Report
1.3 as Parameter set needed calculated value from SubReport
2. Set parmater in the main Report
( with the same name as calculated value in SubReport )
3. Now you can access calculated value from SubReport in Main Report
I hope it will be usefull. i thing it is the best way to send a value
between reports in one project.
"Teros" wrote:
> Quick question...
> I have a report with a subreport. Can I reference a field/textbox in the
> subreport from the main report? For example, if I have a sum calculated by
> the subreport, can I display that in the report?
> Thanks!