Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Wednesday, March 28, 2012

how to get the sum of the fields ...Very URGENT

hi .. iam having a table with six fields which is holding some values.
there are two branches for a company. now they want to see the two branches values at once . that is sum of the stockin,
sum of the stock out etc...

my table is here...
stockin
stockout
stockinhand
openingstock
unitrate
value.

Now i want to get the sum of these two brancheshi,

in ur table there is no feilds to specify the branch like branch id like that.
if there is baranch id then the query is like this.....

select sum(stockin) as stockinn,sum(stockout) as stockoutt from stack where branchid=1

othere wise can u send me how u identify two differnt branches.

Monday, March 26, 2012

How to get the parameter type in VB.net?

I am currently using the following embedded code to get the selected values from a Parameter and display in a textbox. I however have a number of reports and I don't want to include this in all of them. I have created a dll with some other functions but when i try to include the following function it throws an error on the Parameter type. What am I doing wrong, I am not all that familiar with dot net?


Public Function ShowParameterValues(ByVal parameter as Parameter) as String
Dim s as String

If parameter.count <= 5 then
If parameter.IsMultiValue and parameter.count > 1 then
s = " "
For i as integer = 0 to parameter.Count-1
if i = parameter.count - 1
s = s + CStr(parameter.Label(i))
else
s = s + CStr(parameter.Label(i)) + ", "
end if

Next
Else
s = " " + CStr(parameter.Label(0))
End If
else
s = " Only a maximum of 5 selection values can be displayed. "
End if
Return s
End Function

What's the error message?|||I am sorry..it says the type Parameter is not defined.|||

A multi-valued parameter is a 0-based array of objects, I'm pretty sure. But you should be passing the *name* of the parameter you want to reference, as a string, not the object. No?

Then you can say Parameters(tsParamName).Label(i) and Parameters(tsParamName).Count in your code...

HTH,

>L<

|||

It simply means it cannot find the type Parameter, either you need to reference the dll that contains the definition of the type Parameter or make to sure to include the CS file where that type Parameter is defined.

In your code,you are passing parameter as Parameter in the signature of the function, this is where it's complaining, it cannot find the Assembly where the type Parameter is defined.

|||

>>either you need to reference the dll that contains the definition of the type Parameter or make to sure to include the CS file where that type Parameter is defined.

Jonel, I honestly don't think that's correct... rather than including the reference to Parameter, I think the actual type he would need is ReportParameter here ... but in this case he could actually be passing the name of the parameter from the textbox expression (or wherever he's using the function), as I said...

>L<

|||

Hi, Lisa,

From within a custom assembly, you need to provide a fully qualified reference for the parameters type:

Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Parameters

If you use this reference, then when you install new releases of Reporting Services, you may need to recompile and redeploy the custom assembly.

|||

My apologies, Mary, Jonel, and everybody reading -- I misread the original post (saw the "embedded code" part but not that the poster was moving the code into a DLL!). Had a braino...

>L<

|||Thanks guys for your responses. After searching the net last week I found the answer. Thanks much for all your help.

How to get the null values in my stored procedure i am getting error dbnullvalue on front

I have the following stored proc. which i am using on the front end to get all the record from table:

if there are any fields it has anynull values in it i am getting error dbnull value error.
i have null value for ReviewerComment field, can you please tell me how to pass a "" if it is null, in the store proc only, to get all the fresh dat to front end before bnding it to the datagrid control.


CREATE PROCEDURE [dbo].[sp_displayrevws]
AS
select r.RevID,
rtrim(f.revwfunction) as revwfunction,
rtrim(u.uname) as uname,
CONVERT(varchar(10),r.Issued,101) as Issued,
r.ReviewerComment,
r.Response,
r.ModuleID,
rtrim(r.ModuleName) as modulename,
r.ReviewerUserID,r.RevFunctionid,r.Dispositionid
from TAB_ccsNetReviewers r, tabuname u, ccsfunctions f, ccsdisposition d where u.id = r.ReviewerUserID and r.RevFunctionid = f.id and r.Dispositionid = d.id and r.ModuleID = 1 order by r.RevID ASC
GO

Thank you very much.Note use of IsNull() function.


CREATE PROCEDURE [dbo].[sp_displayrevws]
AS
select r.RevID,
rtrim(f.revwfunction) as revwfunction,
rtrim(u.uname) as uname,
CONVERT(varchar(10),r.Issued,101) as Issued,
IsNull(r.ReviewerComment,''),
r.Response,
r.ModuleID,
rtrim(r.ModuleName) as modulename,
r.ReviewerUserID,r.RevFunctionid,r.Dispositionid
from TAB_ccsNetReviewers r, tabuname u, ccsfunctions f, ccsdisposition d where u.id = r.ReviewerUserID and r.RevFunctionid = f.id and r.Dispositionid = d.id and r.ModuleID = 1 order by r.RevID ASC

GO

|||You can use the case statement in sql to look at a field before its returned. For example, you could do this (uses the pubs db)

select au_lname, au_fname,
AuthorCity = Case when (city is null) then '' else city end
from authors

if any city values are null, they'll come back as a '' empty string.

Hope this helps,

Scott

Friday, March 23, 2012

How to get the Data in Values?

hi

i have creat some code to get data from Database like:

Dim strNewsIDAsInteger = Request.QueryString("ID")

Dim NewsconnAsNew System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("SiteSQLServer").ToString())

Dim NewscmdAsNew System.Data.SqlClient.SqlCommand("SELECT FROM News (NewsGroupID, NewsTitle, News, NewsPosition) WHERE NewsID=strNewsID", Newsconn)

Now i wanna get Data in Values

Newsconn.Open()

Dim NewsGroupIDAsInteger = ???

Dim NewsTitleAsString = ???

Dim NewsAsString = ???

Dim NewsPositionAsInteger = ???

Please let me know how?

Newsconn.Close()

DrZ3D:

Dim NewscmdAsNew System.Data.SqlClient.SqlCommand("SELECT FROM News (NewsGroupID, NewsTitle, News, NewsPosition) WHERE NewsID=strNewsID", Newsconn)

I'm not a VB programmer, so someone else will have to help you with the VB syntax.

But the sql command is in a format I've never seen before.

I think you should be issuing this select statement:

"SELECTNewsGroupID, NewsTitle, News, NewsPositionFROM News WHERE ...

|||

you have an SQL connection and a querry.

So what you need now is a SQL Reader and then just loop throght this record set that is returned to get the values.

SqlDataReader readerAs new SqlCommand(query, conn)reader.ExecuteReader() if (reader.HasRows){// get the values here }
but are you getting 1 row returned or more?
|||

my conection is work and i get only one rowe from database

i only wana know how put the record in a value

thanks

|||

I'm not sure how will you provide the value forstrNewsID, so I'm leaving the problem on you. Other than that your modified code is below:

Dim strNewsIDAs Integer = Request.QueryString("ID")
Dim NewsconnAs New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("SiteSQLServer").ToString())

Dim NewscmdAs New System.Data.SqlClient.SqlCommand("SELECT NewsGroupID, NewsTitle, News, NewsPosition FROM News WHERE NewsID=strNewsID", Newsconn)

dim sdr as SqlDataReader

Dim NewsGroupIDAs Integer

Dim NewsTitleAs String

Dim NewsAs String

Dim NewsPositionAs Integer

Newsconn.Open()

sdr = Newscmd.executeReader()

if sdr.HasRows then

sdr.read()

NewsGroupID = sdr("NewsGroupID")
NewsTitle = sdr("NewsTitle")
News = sdr("News")
NewsPosition = sdr("NewsPosition")

end if

sdr.close()
newscommand.dispose()
Newsconn.Close()

Hope you will correct any syntactical errors.

Hope this will help.

Wednesday, March 21, 2012

How to get the database file into .bak file format using C#

Hi,

I want to retrive the values from the database 'northwind' and then i want to store the backup files in"D:/Sample/north_database.bak" format(local machine).

I retrive the database values in .txt,XML format. Now i want to take in .bak format.

give the Suitable solution for this.

Subashini.G

subashi

Check out this article and then download the zip file, to see a sample of the code you want

http://www.codersource.net/csharp_sqldmo_sqlserver.aspx

HTH

|||

Hi,

They Above Article is useful for me. But this coding isstored is database Queries in text(txt) format but i need thedatabase table values stored in .bak format.

Give the solution please

|||

subashini

Take 2

Try

http://www.csharphelp.com/archives2/archive345.html

I think this gets you what you need.

HTH

|||

Thank you Very Much. This coding is very useful for me.....Smile

Regards

Subashini

Monday, March 19, 2012

how to get sqlcmd return values

I'm having a hard time getting a non-zero return value from sqlcmd when a
error in the sql script it is executing occurs.
I've tried setting the -V parm to 10 and -m to 10 (although don't thing -m
is relevant) but regardless ERRORLEVEL is always 0
Here is a sample of the sqlcmd and the os syntax I'm running from within a
sql agent job step:
sqlcmd -U user -P pass -S server -V 10 -h-1 -i "C:\Admin\bcp table space
input file.sql"
echo %ERRORLEVEL%
or
set %ERRORLEVEL% = sqlcmd -U user -P pass -S server -V 10 -h-1 -i
"C:\Admin\bcp table space input file.sql"
also, I've tried different iterations with and without spaces between -V and
10
any help or suggestions is greatly appreciated.What error occurs on the script you run? I just tried with RAISERROR and it
work find. Here's the
bat file:
sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
ECHO %ERRORLEVEL%
pause
And here's the contents of a.sql:
RAISERROR('Ouch', 15, 1)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"paul" <paul@.discussions.microsoft.com> wrote in message
news:5CD9F397-04BD-465F-A818-2E77C30D43BC@.microsoft.com...
> I'm having a hard time getting a non-zero return value from sqlcmd when a
> error in the sql script it is executing occurs.
> I've tried setting the -V parm to 10 and -m to 10 (although don't thing -m
> is relevant) but regardless ERRORLEVEL is always 0
> Here is a sample of the sqlcmd and the os syntax I'm running from within a
> sql agent job step:
> sqlcmd -U user -P pass -S server -V 10 -h-1 -i "C:\Admin\bcp table space
> input file.sql"
> echo %ERRORLEVEL%
> or
> set %ERRORLEVEL% = sqlcmd -U user -P pass -S server -V 10 -h-1 -i
> "C:\Admin\bcp table space input file.sql"
> also, I've tried different iterations with and without spaces between -V a
nd
> 10
>
> any help or suggestions is greatly appreciated.
>|||Here is the error message:
Msg 945, Level 14, State 2, Server servername, Line 1
Database 'databasename' cannot be opened due to inaccessible files or
insufficient memory or disk space. See the SQL Server errorlog for details.
Basically I iterate through different databases and select from some sys
tables. The problem here is one particular db is either in a loading state
or in a suspect state and therefore causes the error. Nonetheless, resolvin
g
that issue is not hard and not as important as just catching the error itsel
f.
Thanks
"Tibor Karaszi" wrote:

> What error occurs on the script you run? I just tried with RAISERROR and i
t work find. Here's the
> bat file:
> sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
> ECHO %ERRORLEVEL%
> pause
> And here's the contents of a.sql:
> RAISERROR('Ouch', 15, 1)
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "paul" <paul@.discussions.microsoft.com> wrote in message
> news:5CD9F397-04BD-465F-A818-2E77C30D43BC@.microsoft.com...
>|||Try the "-b" command line option.
"paul" <paul@.discussions.microsoft.com> wrote in message
news:5CD9F397-04BD-465F-A818-2E77C30D43BC@.microsoft.com...
> I'm having a hard time getting a non-zero return value from sqlcmd when a
> error in the sql script it is executing occurs.
> I've tried setting the -V parm to 10 and -m to 10 (although don't thing -m
> is relevant) but regardless ERRORLEVEL is always 0
> Here is a sample of the sqlcmd and the os syntax I'm running from within a
> sql agent job step:
> sqlcmd -U user -P pass -S server -V 10 -h-1 -i "C:\Admin\bcp table space
> input file.sql"
> echo %ERRORLEVEL%
> or
> set %ERRORLEVEL% = sqlcmd -U user -P pass -S server -V 10 -h-1 -i
> "C:\Admin\bcp table space input file.sql"
> also, I've tried different iterations with and without spaces between -V
> and
> 10
>
> any help or suggestions is greatly appreciated.
>|||Tried this but didn't work. Is my dos look right?
!!sqlcmd -U username -P password -S servername -b -V 10 -h-1 -i
"C:\Admin\bcp table space input file.sql"
!!echo %ERRORLEVEL%
with or without -V doesn't work?
"Mike C#" wrote:

> Try the "-b" command line option.
> "paul" <paul@.discussions.microsoft.com> wrote in message
> news:5CD9F397-04BD-465F-A818-2E77C30D43BC@.microsoft.com...
>
>|||It work just fine for me with such an error as well. Here's what I did:
CREATE DATABASE x
ALTER DATABASE x SET OFFLINE
And here's what I have in the bat file:
sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
ECHO %ERRORLEVEL%
pause
And what is in a.sql:
SELECT 'Hello'
SELECT * FROM x..sysobjects
SELECT 'Hello again'
And below is output from executing the bat file:
C:\>sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
Msg 942, Level 14, State 4, Server TIBWORK\RTM, Line 2
Database 'x' cannot be opened because it is offline.
C:\>ECHO 14
14
C:\>pause
Press any key to continue . . .
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"paul" <paul@.discussions.microsoft.com> wrote in message
news:7B3754E7-C857-4BE3-9DFD-14BED25FD33B@.microsoft.com...
> Here is the error message:
> Msg 945, Level 14, State 2, Server servername, Line 1
> Database 'databasename' cannot be opened due to inaccessible files or
> insufficient memory or disk space. See the SQL Server errorlog for detail
s.
>
> Basically I iterate through different databases and select from some sys
> tables. The problem here is one particular db is either in a loading stat
e
> or in a suspect state and therefore causes the error. Nonetheless, resolv
ing
> that issue is not hard and not as important as just catching the error its
elf.
> Thanks
>
> "Tibor Karaszi" wrote:
>|||Tibor,
Thanks for following through. Can you try one more thing that I'm wondering
may be having an effect.
Change you select sql to be a dynamically executed string.
Like this:
declare @.sql varchar(255)
set @.sql = 'select * from x..sysobjects'
select 'Hello'
exec(@.sql)
select 'Hello again'
If that works on your machine, I would say it is something local to mine,
else I'm wondering if exec() behaves the way I'm expecting it to.
Thanks again.
"Tibor Karaszi" wrote:

> It work just fine for me with such an error as well. Here's what I did:
> CREATE DATABASE x
> ALTER DATABASE x SET OFFLINE
> And here's what I have in the bat file:
> sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
> ECHO %ERRORLEVEL%
> pause
> And what is in a.sql:
> SELECT 'Hello'
> SELECT * FROM x..sysobjects
> SELECT 'Hello again'
>
> And below is output from executing the bat file:
> C:\>sqlcmd -STIBWORK\RTM -V10 -h-1 -ia.sql
> Msg 942, Level 14, State 4, Server TIBWORK\RTM, Line 2
> Database 'x' cannot be opened because it is offline.
> C:\>ECHO 14
> 14
> C:\>pause
> Press any key to continue . . .
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "paul" <paul@.discussions.microsoft.com> wrote in message
> news:7B3754E7-C857-4BE3-9DFD-14BED25FD33B@.microsoft.com...
>|||Same result. I still managed to catch the error with errorlevel.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"paul" <paul@.discussions.microsoft.com> wrote in message
news:1AB3EA52-EAB2-4C11-82A2-E0A9A97A0B19@.microsoft.com...
> Tibor,
> Thanks for following through. Can you try one more thing that I'm wonderi
ng
> may be having an effect.
> Change you select sql to be a dynamically executed string.
> Like this:
> declare @.sql varchar(255)
> set @.sql = 'select * from x..sysobjects'
> select 'Hello'
> exec(@.sql)
> select 'Hello again'
>
> If that works on your machine, I would say it is something local to mine,
> else I'm wondering if exec() behaves the way I'm expecting it to.
> Thanks again.
>
> "Tibor Karaszi" wrote:
>|||I've been able to run it ok and get the return error value as well... I'm
running SQL 2K5 SP 1 if that makes a difference.
"paul" <paul@.discussions.microsoft.com> wrote in message
news:6897329C-EEFC-4756-A1DA-46E366EAF3EA@.microsoft.com...
> Tried this but didn't work. Is my dos look right?
> !!sqlcmd -U username -P password -S servername -b -V 10 -h-1 -i
> "C:\Admin\bcp table space input file.sql"
> !!echo %ERRORLEVEL%
> with or without -V doesn't work?
>
>
> "Mike C#" wrote:
>|||Tibor / Mike,
Thanks for all your help, I believe I have solved the riddle. As contorted
as my logic might seem, I am actually calling numerous sqlcmd from inside th
e
same transact sql bactch.
To do this I am prefixing it of course with '!!'. So there in lies the
problem, each !!sqlcmd must be spawning its own dos session so if I do the
following:
!!sqlcmd ....
!!echo %errorlevel%
error level will always be 0 in the second dos session.
thanks for helping with that guys
"Tibor Karaszi" wrote:

> Same result. I still managed to catch the error with errorlevel.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "paul" <paul@.discussions.microsoft.com> wrote in message
> news:1AB3EA52-EAB2-4C11-82A2-E0A9A97A0B19@.microsoft.com...
>

Friday, March 9, 2012

How to get rank?

I would like to write a query that gives me the values of a set of
observations, and their rank.

CREATE TABLE #Values(val int)
INSERT #Values SELECT 1
INSERT #Values SELECT 5
INSERT #Values SELECT 10

I would like to select this:

1 10 -- rank 1, value 10
2 5
3 1

I can put them into a temp table with an identity column, ordered by
the column I'm interested in, and then retrieve in order by the
identity column. I'm wondering if there's a way to do that with a
subquery.

Thanks,
JimRunning count is one way

CREATE TABLE #Values(val int)
INSERT #Values SELECT 1
INSERT #Values SELECT 5
INSERT #Values SELECT 10

select (select count(*) from #Values v where val <= v2.Val) as Rank,*
from #Values v2
order by 2

Denis the SQL Menace
http://sqlservercode.blogspot.com/

jim_geiss...@.countrywide.com wrote:
> I would like to write a query that gives me the values of a set of
> observations, and their rank.
> CREATE TABLE #Values(val int)
> INSERT #Values SELECT 1
> INSERT #Values SELECT 5
> INSERT #Values SELECT 10
> I would like to select this:
> 1 10 -- rank 1, value 10
> 2 5
> 3 1
> I can put them into a temp table with an identity column, ordered by
> the column I'm interested in, and then retrieve in order by the
> identity column. I'm wondering if there's a way to do that with a
> subquery.
> Thanks,
> Jim|||Jim,

if you are using SS 2005 , use row_number() or rank() OLAP function|||Where do you want to show data?
If you use front end application, do Ranking there

Madhivanan


jim_geissman@.countrywide.com wrote:

Quote:

Originally Posted by

> I would like to write a query that gives me the values of a set of
> observations, and their rank.
> CREATE TABLE #Values(val int)
> INSERT #Values SELECT 1
> INSERT #Values SELECT 5
> INSERT #Values SELECT 10
> I would like to select this:
> 1 10 -- rank 1, value 10
> 2 5
> 3 1
> I can put them into a temp table with an identity column, ordered by
> the column I'm interested in, and then retrieve in order by the
> identity column. I'm wondering if there's a way to do that with a
> subquery.
> Thanks,
> Jim

Wednesday, March 7, 2012

How to get nextval while inserting a row to database

I try to make something or set an option, which would generate next values of the id of some table (id is primary key) while inserting a row to the table. I used once a sequence for Oracle database and wonder if there is something similar in .Net for "standard" database (Add new item -> SQL Database). I'm using SqlDataSources.

Is Repeater a component that would be useful here? Or shall i write a function that would generate ids manually?

Thanks in advance

I think what you want is an IDENTITY column. Here's a simple article with exampleshttp://www.databasejournal.com/features/mssql/article.php/3307541 and here's the more detailed stuff from MSDN http://msdn2.microsoft.com/en-us/library/aa933196(SQL.80).aspx

|||

Yes, it works now! I didn't noticed 'Column properties' in table definition ^_^

That was exactly what i was looking for - thanks!

How to get next range of Ident values for Merge Replication

You can use sp_adjustpublisheridentityrange on the
publisher.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Hi Paul,
Is there a method to specify what the next seed value should be?
Thanks
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:1bc101c4fd41$e9448560$a301280a@.phx.gbl...
> You can use sp_adjustpublisheridentityrange on the
> publisher.
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||You could hack into MSrepl_identity_range but I
definitely wouldn't advise this. I know this sounds a
pain, but to avoid any issues like this, I'd consider
reinitializing and setting such a large range that this
can never be an issue in future - either that or manual
range management, but that can be difficult to set up if
you have a lot of subscribers.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

how to get minimum value from a list of user defined values

i've three variables in my stored proc. & i want get the least of them.
i know i can do that using case or if statements but i want to does
T-SQL provides any other way of doing it.
regards,
rameshHere you go
DECLARE @.num1 int
DECLARE @.num2 int
DECLARE @.num3 int
SET @.num1 = 5
SET @.num2 = 3
SET @.num3 = 7
SELECT Min(Num)
FROM
(SELECT @.num1 AS Num
UNION ALL
SELECT @.num2
UNION ALL
SELECT @.num3) T
Regards
Roji. P. Thomas
http://toponewithties.blogspot.com
<rameshsaive@.gmail.com> wrote in message
news:1139377057.261785.191850@.f14g2000cwb.googlegroups.com...
> i've three variables in my stored proc. & i want get the least of them.
> i know i can do that using case or if statements but i want to does
> T-SQL provides any other way of doing it.
>
> regards,
> ramesh
>

Friday, February 24, 2012

How to get largest 3 values from 5 columns

Hi,

I wondered if someone could help me, I'm new to defining my own SQL statements!

I am looking to extract 4 columns of data from a Access database, these columns I am pasting into a table. That I can do using the select query, and set them AS variable1 to 4.

(I am putting these variables into an ASP page)

My problem comes when I need to create an extra column which shows the best 3 results from the 4 returned data points. In excel I would use something such as =Large(CellA1:E1, 1) to give me the largest value and then so on for the largest 3, and then summate these three values.

I have pasted my code so far below:

I'd be very grateful if someone could enlighten me.

Many thanks!
__________________________________________________ ____

ResultsSQL = "SELECT *, (Round1Pts) AS Round1Points, " & _
"(Round2Pts) AS Round2Points, " & _
"(Round3Pts) AS Round3Points, " & _
"(Round4Pts) AS Round4Points, " & _
"(????) AS Best3Points " & _
"FROM " & ResultsTable & " ORDER BY (Best3Points) DESC, (DriverName) DESC"Did you try using the MAX function?

MAX(Round1Pts,MAX(Round2Pts,MAX(Round3Pts,MAX(Roun d4Pts)))) AS Best3Points
...etc...
:cool:

how to get just a single value from an sql database and show it in a table.

I would like to get single values from a huge sql server and put it into a table. let's say 4 by 4. How do I do that?

I have a connection string with a select statement that will only return a value. But, I do not know how to put that value into a table.

Thank you.

Hi,

You want to display data from a SQL Server database on a page having a 4 x 4 Table right? Trying reading a bit about using GridView Control, or give me a bit more detail

|||

Dearmic_lch

If you only want to display value. I think gridview is the best solution. Can u give me more information about your table ?, which fields do you want to display?

|||

I understand about GridView and I think it's great. However, I am having problems showing an N * N gridview.

For example, I wanted to create Year vs Age Matrix, but, Gridview functionality is limited. Can I do that with gridview?

|||

Hi, mic_lch,

I'm not quite sure what kind of result you need to get. Could you give us an example of the output?

Thanks!

Sunday, February 19, 2012

how to get FromDate and ToDate values from database

Hi All,

I have to fetch FromDate and Todate values from the table like this.Suppose Fromdate value is 02-Feb-2007 and Todate Value is 04-Feb-2007,then my need is to get the date value like this.....Feb 2-4,2007or 2-4 Feb,2007.Can anybody know the syntax or code?.I am using sql Server.

Thanks and Regards

What dataType are you storing in your DB? SmallDateTime...? Are you storing these dates in two fields?

|||

Datatype is date for sqlserver and yes these dates are stored in two different fields like 8/4/2007 12:00:00 AM.

|||

Here you go. Assuming your columns are named from_date and to_date. This also assumes that your dates are within the same month and year, as per your example.

Selectconvert(varchar(2),DatePart(day, from_date)) +'-' +convert(varchar(2),DatePart(day, to_date))+' '+substring(convert(varchar(12), to_date, 106), 4, 8)from [yourtable]

how to get driopdown for year

how can i display the dropdown for year values in sql reporting

i want to accept the value for year as parameter & also want user to select the value from dropdown that will display only the year values.

What product are you using?

Can you give more details about your situation.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.