Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Friday, March 30, 2012

How can I remove the workitem type from the existing project?

When creating a new project using 'Agile' process template, there are 5 workitem types in the list of workitem type by default. After the project being created, how can I delete some workitem type that we don' t need?

For example, my team will never use 'Senario' workitem type for the project and I would like to remove this workitem type from the list. So no team member will see 'Senario' workitem type in the list when creating workitem, and therefore no one will create a workitem using 'Senario' workitem type by accident.

I understand that workitem type can't be deleted if it is used to created any workitem. So what I mean is the workitem type that has never used to create any workitem.

Thanks.

Unfortunately you cannot remove them from the list even if you have never created one. You can remove them from the template prior to creating a project and they will never be in the project. You could also try to put security on the transition from nothing to new for TFSAdmins only. That way the typical users would not be able to create a new workitem of the type Scenario. There may be other creative ways, but in the end they will still show in the list.

-paul

|||Thanks.

Wednesday, March 28, 2012

How can I read type of all fields in joined query?

How can I read type of all fields in joined query?

Is there a stored procedure method to use for this purpose?

Thanks

What language needs to know this? c#/VB? T-Sql?

If c#/vb, and you are loading things into a DataTable, the meta-data is available in the DataTable object. I suspect it's availabe in DataReaders, etc.

|||

Hi David,

I need T-SQL stored procedure that gave me type of all fields in a joined query.

Thanks for your help

|||

create procedure get_stuff

as

begin

select col_1, col_2, col_3 from some_table
union
select col_a, col_b, col_c from some_other_table


end

That's the basic syntax. Check the manual for how to add parameters if needed.

Friday, March 23, 2012

How can i preserve data type during the export to Excel

When i export data to a Excel file numeric fields are exported as
General type in excel.
Does anybody know how can i preserve numeric type for this columns
(double, float or integer).On 30.10.2006 12:00, Sale wrote:
> When i export data to a Excel file numeric fields are exported as
> General type in excel.
> Does anybody know how can i preserve numeric type for this columns
> (double, float or integer).
>
How do you export them? Did you try to import them from Excel directly
via ODBC data source?
robert|||> How do you export them? Did you try to import them from Excel directly
> via ODBC data source?
> robert
I use DTS package for export to Exel|||Maybe better question is wich data type Excel accept as number when i
perform export from SQL server ( via DTS). I tried double (SQL offer
this as a default), and decimal, but result remain the same.

How can i preserve data type during the export to Excel

When i export data to a Excel file numeric fields are exported as
General type in excel.
Does anybody know how can i preserve numeric type for this columns
(double, float or integer).On 30.10.2006 12:00, Sale wrote:
> When i export data to a Excel file numeric fields are exported as
> General type in excel.
> Does anybody know how can i preserve numeric type for this columns
> (double, float or integer).
>
How do you export them? Did you try to import them from Excel directly
via ODBC data source?
robert|||> How do you export them? Did you try to import them from Excel directly
> via ODBC data source?
> robert
I use DTS package for export to Exel|||Maybe better question is wich data type Excel accept as number when i
perform export from SQL server ( via DTS). I tried double (SQL offer
this as a default), and decimal, but result remain the same.

How can I Passing Table type variable as Output Param

Hi,
How can I pass table type OUTPUT param to a stored procedure ?
regards,> How can I pass table type OUTPUT param to a stored procedure ?
> regards,
Table data type is not allowed for a SP parameter. If you need to use the
rowset returned in T-SQL code, you have two possibilties:
- change the procedure to a table-valued UDF
- save the output in a temp table.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com

How can I pass a large XML document from a column of data type ntext to a stored procedure

I'm trying to "prepare" a large xml document that we've
stored (as a string) in our database as an ntext
document. I can't seem to find a way to pass the ntext
datatype to sp_xml_preparedocument. Ntext are not allowed
as local variables, and I'm not sure how chopping up the
ntext, with readtext can help me.

sp_xml_preparedocument @.idoc output, (ntext)

In SQL 2005, you can cast the ntext to nvarchar(max) or the XML datatype and go from there using either OPENXML or XQuery to manipulate the XML.

For SQL 2000, if you know the offset of the data in the buffer, you can use the READTEXT functions to access them. Otherwise you could write code outside of the database that selected the values and converted them using native or managed data access API's. But in general in SQL 2000 you cannot have a variable that is bigger than 4000 unicode characters. SQL 2005 removes this restriction.

Monday, March 19, 2012

how can i make checkbox

hello all i have a 2 questions hope that u can help me my first question is: in ms access there was a data type named yes/no and it was a checkbox is there a checkbox data type in sql server 2005?

my second question is i need the connection code between asp.net 2005 and sql server 2005 i searched in here for that code but i got more confuse i found two codes and both are not working so hope u can give me the right connecting code. that's all thanks

Thebitdata Type is the equivelent to ths Yes/No data type.

If you mean the connection string, it is like this for SQL Server 2005:

server=<ServerAddress>;uid=<userId>;password=<password>;database=<databaseName>

Of course, fill in the bold to the actual values. Also, heres a good website if you ever need any connection strings:

http://www.connectionstrings.com/

|||

hellojavanthanks for ur reply i tried the bit data type but no checkbox appeared and i tried to write yes but it didnt accept that value so plase hope u tell me what i shoud do? and as for the connection string i dont mean that string but i mean the main connection string for example in vs2003 when i want to connect to a database that's what i should do:

Dim conn as newsqlconnection (the string u wrote is here)

the bold statment that what i want to know? thanks for ur reply again

|||no one can help?!!!!!|||

Datatypes are not restricted to a specific UI control that can display it like in Access. Some applications that use a grid-like or form-like interface to allow you to enter values into a table will display a checkbox for a column that is defined as bit (or bit not nullable), while some others will display it as it's raw value of 0 or 1. Depends on the tool.

In ASP.NET, you have the option of displaying it to the end user any way you want. I believe the form wizards by default will make a checkbox out of it, and some datagrids will as well, I am unsure of what the built in datagrid will do, I'd guess mostly a textbox with 0 or 1 in it. The gridview might be more intelligent than that, but I wouldn't bet on it either.

The bit datatype is the closest match, but you could also make a column of char(1) and store "Y"/"N" in it and use a checkbox to display it to the end user, but I know of no tools that will automatically turn that into a checkbox for you. You could also make it a varchar(3) and store "yes"/"no" in it as well, and optionally put a check constraint to make sure only the values "yes"/"no" or "Y"/"N" are able to be stored in there.

|||helloMotleythanks for ur reply and as u said there as an option in the gridview allow me to delete and select and edit in the properties box but i have another problem when i get to delete a record i have an error said that deleting is not supported by data source i serched for that error and i knew that the solution is when i configuring my data source in the data source wizard i have to click on advanced sql generation option that let me check two choices to enable insert and deleting and update the problem is that two choices are not active i dont know why so please if u can help me then i'm waiting thanks for u all.|||Sorry, I was away in Florida and couldn't check my emails. The bit data type is actually a 0 or 1 value. It is the closest thing you can get to Yes/No in Sql Server. You have to check the value of your checkbox and insert the proper data type based on that. I wouldnt recommend doing a char(1) because that is not a true yes/no type field.|||hello again javan thanks for ur care about reply but i have a little problem as i said in my last post that advanced option button is not active so i hope u can really help cos i really need that option thanks for u all.|||Yes,... I found this problem in the SQL DataSource too before. It seems that once the datasource is created then the option is not available when you go to edit it. What you have to do is delete and then recreate the datasource and make sure you press the advanced options on the first try. The check the "Generate Insert/Edit/Delete" checkbox.|||hello JAVAN thanks for ur reply i did as u said but no use problem still exist anyway i sent u private msg hope u reply it thanks again.|||

The "Generate Insert,Update,etc..." checkbox may not be visible if you are not returning a Primary Key field from the database or if you do not have one defined. You must return a PRimary Key field from the select statement for the SQL DataSource to be able to update the records.

|||

hello dear javan

i have that problem(update&.. checkboxes) for about 6 days but ur answers help me tp solve it.

so thanks for ever

be lucky and successful like always

how can I make a report that will run against a list of servers?

Hi, I have SQL 2005 sp2 installed on a test server that I run admin type
reports from. I have a report that I want to run against a list of servers,
the list is from an SQL table on the same server as RS. I've found that data
source parameters are possible, but I can't seem to get it to work. Can
anyone point to an example?Have you tried the examples provided? You mention data source parameters. It
makes me wonder if you are looking at the right information. What you want
to do is base your data source as an expression. From Books OnLine
>>>>>>
You can put an expression into a connection string to allow users to select
the data source at run time. For example, suppose a multinational firm has
data servers in several countries. With an expression-based connection
string, a user who is running a sales report can select a data source for a
particular country before running the report.
The following example illustrates the use of a data source expression in a
SQL Server connection string. The example assumes you have created a report
parameter named ServerName:
Copy Code
="data source=" & Parameters!ServerName.Value & ";initial
catalog=AdventureWorks
Data source expressions are processed at run time or when a report is
previewed. The expression must be written in Visual Basic. Use the following
guidelines when defining a data source expression:
a.. Design the report using a static connection string. A static
connection string refers to a connection string that is not set through an
expression (for example, when you follow the steps for creating a
report-specific or shared data source, you are defining a static connection
string). Using a static connection string allows you to connect to the data
source in Report Designer so that you can get the query results you need to
create the report.
b.. When defining the data source connection, do not use a shared data
source. You cannot use a data source expression in a shared data source. You
must define a report-specific data source for the report.
c.. Specify credentials separately from the connection string. You can use
stored credentials, prompted credentials, or integrated security.
d.. Add a report parameter to specify a data source. For parameter values,
you can either provide a static list of available values (in this case, the
available values should be data sources you can use with the report) or
define a query that retrieves a list of data sources at run time.
e.. Be sure that the list of data sources shares the same database schema.
All report design begins with schema information. If there is a mismatch
between the schema used to define the report and the actual schema used by
the report at run time, the report might not run.
f.. Before publishing the report, replace the static connection string
with an expression. Wait until you are finished designing the report before
you replace the static connection string with an expression. Once you use an
expression, you cannot execute the query in Report Designer. Furthermore,
the field list in the Datasets window and the Parameters list will not
update automatically.
>>>>>>>
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
news:9260F115-1407-4227-8A74-2D545456E620@.microsoft.com...
> Hi, I have SQL 2005 sp2 installed on a test server that I run admin type
> reports from. I have a report that I want to run against a list of
> servers,
> the list is from an SQL table on the same server as RS. I've found that
> data
> source parameters are possible, but I can't seem to get it to work. Can
> anyone point to an example?
begin 666 copycode.gif
M1TE&.#EA#P`/`.9F`).BM[+"V*[$\(&NY:Z_U'.AWER,VIBKQBE4JIFLQ_S]
M_LO/U)*P[8JN_,73\JFXSF2%R=;>[/;Y_>OO]BM7L6Z<VB)&CZ:]["!!AJ"Y
M[VB7U9RPSM+;\9>FNZ.RR"-(EOGZ_")%CIRKP;+)\*[0_Z^^U#5EQ2E4K*FY
MSX*?V,_9YM+6W9JMRFZ7YV".Y\S7[-'ZINOS)"JX+K:_^KO^R5,FR=0HIJN
MRI:FN^;J\^#F\25-G25*F+_+W=+>\,#*X,+.Y/7V^[K%U/O]_B-'DG^G\_#T
M^\?2X7.2T4=NNI_%^B%#B=OD]_?X^Z_#[?#R^)>IQ*K![XZX\"%#BIRUYZ*Q
MQV:"I?#S^*.RQYJNS*O"[]/>]55YP2I7LW*:ZH6GZR=0I%MRC[[.\#5)8U&#
MT?_______P``````````````````````````````````````````````````
M`````````````````````````````````````````````````"'Y! $``&8`
M+ `````/``\```>?@.&:"@.X2%AH>"`0$$! \>*X@.!99-E558+AR64"CA"89B%
M*&4S)#X``EI1&0P,+X)8DR!/.0*495\F0&8B94I2`P47MEXC%#\="D$3.A%4
M90T-'"Y=)V `3< 5&C*41DP.63L`5S J1STI944M!F1D-SP`8_/S2&5#-%MB
F3@.E$AA!EVKDC<R"$(2X2-L1@.D> `E"6&DB! 8*/&!PM3, 0"`#L`
`
end|||Thanks for the prompt reply Bruce. The BOL info you listed was the
information I was looking at. However, I want my reports to run
automatically, with no user intervention against a list of server names.
What led me to believe this was possible was the quote:
> d.. Add a report parameter to specify a data source. For parameter values,
> you can either provide a static list of available values (in this case, the
> available values should be data sources you can use with the report) or
> define a query that retrieves a list of data sources at run time.
Is this still possible ?
"Bruce L-C [MVP]" wrote:
> Have you tried the examples provided? You mention data source parameters. It
> makes me wonder if you are looking at the right information. What you want
> to do is base your data source as an expression. From Books OnLine
> >>>>>>
> You can put an expression into a connection string to allow users to select
> the data source at run time. For example, suppose a multinational firm has
> data servers in several countries. With an expression-based connection
> string, a user who is running a sales report can select a data source for a
> particular country before running the report.
> The following example illustrates the use of a data source expression in a
> SQL Server connection string. The example assumes you have created a report
> parameter named ServerName:
> Copy Code
> ="data source=" & Parameters!ServerName.Value & ";initial
> catalog=AdventureWorks
> Data source expressions are processed at run time or when a report is
> previewed. The expression must be written in Visual Basic. Use the following
> guidelines when defining a data source expression:
> a.. Design the report using a static connection string. A static
> connection string refers to a connection string that is not set through an
> expression (for example, when you follow the steps for creating a
> report-specific or shared data source, you are defining a static connection
> string). Using a static connection string allows you to connect to the data
> source in Report Designer so that you can get the query results you need to
> create the report.
>
> b.. When defining the data source connection, do not use a shared data
> source. You cannot use a data source expression in a shared data source. You
> must define a report-specific data source for the report.
>
> c.. Specify credentials separately from the connection string. You can use
> stored credentials, prompted credentials, or integrated security.
>
> d.. Add a report parameter to specify a data source. For parameter values,
> you can either provide a static list of available values (in this case, the
> available values should be data sources you can use with the report) or
> define a query that retrieves a list of data sources at run time.
>
> e.. Be sure that the list of data sources shares the same database schema.
> All report design begins with schema information. If there is a mismatch
> between the schema used to define the report and the actual schema used by
> the report at run time, the report might not run.
>
> f.. Before publishing the report, replace the static connection string
> with an expression. Wait until you are finished designing the report before
> you replace the static connection string with an expression. Once you use an
> expression, you cannot execute the query in Report Designer. Furthermore,
> the field list in the Datasets window and the Parameters list will not
> update automatically.
> >>>>>>>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
> news:9260F115-1407-4227-8A74-2D545456E620@.microsoft.com...
> > Hi, I have SQL 2005 sp2 installed on a test server that I run admin type
> > reports from. I have a report that I want to run against a list of
> > servers,
> > the list is from an SQL table on the same server as RS. I've found that
> > data
> > source parameters are possible, but I can't seem to get it to work. Can
> > anyone point to an example?
>
>|||You could have a main report that is empty. Then have a subreport that has a
parameter like the example. Embed the subreport into the main report, right
mouse click, parameters and map the parameter to one of the server. Repeat
with a different server with each subreport.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
news:02A4BBD3-9376-4EA9-AE7D-A89FFE9FD75F@.microsoft.com...
> Thanks for the prompt reply Bruce. The BOL info you listed was the
> information I was looking at. However, I want my reports to run
> automatically, with no user intervention against a list of server names.
> What led me to believe this was possible was the quote:
>> d.. Add a report parameter to specify a data source. For parameter
>> values,
>> you can either provide a static list of available values (in this case,
>> the
>> available values should be data sources you can use with the report) or
>> define a query that retrieves a list of data sources at run time.
> Is this still possible ?
>
> "Bruce L-C [MVP]" wrote:
>> Have you tried the examples provided? You mention data source parameters.
>> It
>> makes me wonder if you are looking at the right information. What you
>> want
>> to do is base your data source as an expression. From Books OnLine
>> >>>>>>
>> You can put an expression into a connection string to allow users to
>> select
>> the data source at run time. For example, suppose a multinational firm
>> has
>> data servers in several countries. With an expression-based connection
>> string, a user who is running a sales report can select a data source for
>> a
>> particular country before running the report.
>> The following example illustrates the use of a data source expression in
>> a
>> SQL Server connection string. The example assumes you have created a
>> report
>> parameter named ServerName:
>> Copy Code
>> ="data source=" & Parameters!ServerName.Value & ";initial
>> catalog=AdventureWorks
>> Data source expressions are processed at run time or when a report is
>> previewed. The expression must be written in Visual Basic. Use the
>> following
>> guidelines when defining a data source expression:
>> a.. Design the report using a static connection string. A static
>> connection string refers to a connection string that is not set through
>> an
>> expression (for example, when you follow the steps for creating a
>> report-specific or shared data source, you are defining a static
>> connection
>> string). Using a static connection string allows you to connect to the
>> data
>> source in Report Designer so that you can get the query results you need
>> to
>> create the report.
>>
>> b.. When defining the data source connection, do not use a shared data
>> source. You cannot use a data source expression in a shared data source.
>> You
>> must define a report-specific data source for the report.
>>
>> c.. Specify credentials separately from the connection string. You can
>> use
>> stored credentials, prompted credentials, or integrated security.
>>
>> d.. Add a report parameter to specify a data source. For parameter
>> values,
>> you can either provide a static list of available values (in this case,
>> the
>> available values should be data sources you can use with the report) or
>> define a query that retrieves a list of data sources at run time.
>>
>> e.. Be sure that the list of data sources shares the same database
>> schema.
>> All report design begins with schema information. If there is a mismatch
>> between the schema used to define the report and the actual schema used
>> by
>> the report at run time, the report might not run.
>>
>> f.. Before publishing the report, replace the static connection string
>> with an expression. Wait until you are finished designing the report
>> before
>> you replace the static connection string with an expression. Once you use
>> an
>> expression, you cannot execute the query in Report Designer. Furthermore,
>> the field list in the Datasets window and the Parameters list will not
>> update automatically.
>> >>>>>>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
>> news:9260F115-1407-4227-8A74-2D545456E620@.microsoft.com...
>> > Hi, I have SQL 2005 sp2 installed on a test server that I run admin
>> > type
>> > reports from. I have a report that I want to run against a list of
>> > servers,
>> > the list is from an SQL table on the same server as RS. I've found
>> > that
>> > data
>> > source parameters are possible, but I can't seem to get it to work.
>> > Can
>> > anyone point to an example?
>>|||I'll give it a shot & let you know. Thanks.
"Bruce L-C [MVP]" wrote:
> You could have a main report that is empty. Then have a subreport that has a
> parameter like the example. Embed the subreport into the main report, right
> mouse click, parameters and map the parameter to one of the server. Repeat
> with a different server with each subreport.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
> news:02A4BBD3-9376-4EA9-AE7D-A89FFE9FD75F@.microsoft.com...
> > Thanks for the prompt reply Bruce. The BOL info you listed was the
> > information I was looking at. However, I want my reports to run
> > automatically, with no user intervention against a list of server names.
> > What led me to believe this was possible was the quote:
> >> d.. Add a report parameter to specify a data source. For parameter
> >> values,
> >> you can either provide a static list of available values (in this case,
> >> the
> >> available values should be data sources you can use with the report) or
> >> define a query that retrieves a list of data sources at run time.
> >
> > Is this still possible ?
> >
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> Have you tried the examples provided? You mention data source parameters.
> >> It
> >> makes me wonder if you are looking at the right information. What you
> >> want
> >> to do is base your data source as an expression. From Books OnLine
> >> >>>>>>
> >> You can put an expression into a connection string to allow users to
> >> select
> >> the data source at run time. For example, suppose a multinational firm
> >> has
> >> data servers in several countries. With an expression-based connection
> >> string, a user who is running a sales report can select a data source for
> >> a
> >> particular country before running the report.
> >>
> >> The following example illustrates the use of a data source expression in
> >> a
> >> SQL Server connection string. The example assumes you have created a
> >> report
> >> parameter named ServerName:
> >>
> >> Copy Code
> >> ="data source=" & Parameters!ServerName.Value & ";initial
> >> catalog=AdventureWorks
> >>
> >> Data source expressions are processed at run time or when a report is
> >> previewed. The expression must be written in Visual Basic. Use the
> >> following
> >> guidelines when defining a data source expression:
> >>
> >> a.. Design the report using a static connection string. A static
> >> connection string refers to a connection string that is not set through
> >> an
> >> expression (for example, when you follow the steps for creating a
> >> report-specific or shared data source, you are defining a static
> >> connection
> >> string). Using a static connection string allows you to connect to the
> >> data
> >> source in Report Designer so that you can get the query results you need
> >> to
> >> create the report.
> >>
> >>
> >> b.. When defining the data source connection, do not use a shared data
> >> source. You cannot use a data source expression in a shared data source.
> >> You
> >> must define a report-specific data source for the report.
> >>
> >>
> >> c.. Specify credentials separately from the connection string. You can
> >> use
> >> stored credentials, prompted credentials, or integrated security.
> >>
> >>
> >> d.. Add a report parameter to specify a data source. For parameter
> >> values,
> >> you can either provide a static list of available values (in this case,
> >> the
> >> available values should be data sources you can use with the report) or
> >> define a query that retrieves a list of data sources at run time.
> >>
> >>
> >> e.. Be sure that the list of data sources shares the same database
> >> schema.
> >> All report design begins with schema information. If there is a mismatch
> >> between the schema used to define the report and the actual schema used
> >> by
> >> the report at run time, the report might not run.
> >>
> >>
> >> f.. Before publishing the report, replace the static connection string
> >> with an expression. Wait until you are finished designing the report
> >> before
> >> you replace the static connection string with an expression. Once you use
> >> an
> >> expression, you cannot execute the query in Report Designer. Furthermore,
> >> the field list in the Datasets window and the Parameters list will not
> >> update automatically.
> >>
> >> >>>>>>>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >>
> >> "DBAGURU" <DBAGURU@.discussions.microsoft.com> wrote in message
> >> news:9260F115-1407-4227-8A74-2D545456E620@.microsoft.com...
> >> > Hi, I have SQL 2005 sp2 installed on a test server that I run admin
> >> > type
> >> > reports from. I have a report that I want to run against a list of
> >> > servers,
> >> > the list is from an SQL table on the same server as RS. I've found
> >> > that
> >> > data
> >> > source parameters are possible, but I can't seem to get it to work.
> >> > Can
> >> > anyone point to an example?
> >>
> >>
> >>
>
>

Monday, February 27, 2012

How can i get time?

There is a field which type is datetime in my table, when the filed is '2006-06-03 23:00:00', how can i get '2006-06-03' from the field?

TRY THIS

SELECT CONVERT(VARCHAR(10), '2006-06-03 23:00:00')

REGARDS

ANAS

|||

This only works if the field is a varchar. You would need to set a different style or you will get "Jun 3 200". See below...

IF OBJECT_ID('test', 'U') IS NOT NULL

DROP TABLE dbo.test

GO

CREATE TABLE dbo.test

(

testDate datetime

)

INSERT dbo.test (testDate) VALUES ('2006-06-03 23:00:00')

--This returns "Jun 3 200"

SELECT CONVERT(VARCHAR(10), testDate) FROM dbo.test

--This returns 2006-06-03

SELECT REPLACE(CONVERT(VARCHAR(10), testDate, 102), '.', '-') FROM dbo.test

Sunday, February 19, 2012

How can I find the biggest value in a field of type nvarchar?

I have a field of type nvarchar and length 4. For reasons tied to design, the type must remain as nvarchar.

The data will look something like 0001 and increase to 9999

How can I find the biggest value?

Right now I am going through all the rows programatically, which is inefficient. Is there an sql query that allows me to find the biggest value? Remember the type is nvarchar, and there could be values like 999, thus selecting MAX or ORDER does not work.

Thanks.Try using CAST or CONVERT in your SQL to cast the value to anint datatype before using MAX.|||Yep, that should do.

Thanks for the fast reply.