Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts

Sunday, March 25, 2012

determine if autoincrement is set in a table, form asp.net

I want to access sqlserver table properties from asp.net .

How do i know that a table defined in sqlserver has autoincrement field or not.

Actually i have to access all the tables in a database and execute different function for table with auto increment on and off.

I am not being able identify this property from codes.
Please help.
thank you

Hey,

When you connect to the database, you can't know that from ADO.NET; you have to recreate identities manually on the ADO.NET side. However, if you have SQL Server 2005 API's installed, you can use the SMO objects to connect to a 7.0, 2000, or 2005 database and find this information out.

|||Thanks brian

I am using sql 2000 and SqlDataAdapter object

I think the following code should work but its not working.
any ideas

Dim dsAs DataSet ' = ( got dataset from a table)
Dim hasAutoIncrementAsBoolean =FalseForEach columnAs DataColumnIn ds.Tables(0).Columns If column.AutoIncrementThen

hasAutoIncrement =

True
ExitFor EndIfNext|||

Hey,

The problem is there isn't any autoincrement returned back from the dataset; you have to establish that programatically. So you need to do:

dataSet.Tables(0).Columns(0).AutoIncrement = true
dataSet.Tables(0).Columns(0).AutoIncrementStep = 1

Etc. You have to set this up by yourself; it doesn't pull it back for you.

|||
SELECT *,COLUMNPROPERTY(OBJECT_ID(TABLE_NAME),COLUMN_NAME,'IsIdentity')AS IS_IDENTITYFROM INFORMATION_SCHEMA.COLUMNS
|||

Which would lead you to this query:

SELECT COUNT(*)

FROM (

SELECT

*,COLUMNPROPERTY(OBJECT_ID(TABLE_NAME),COLUMN_NAME,'IsIdentity')AS IS_IDENTITY

FROM

INFORMATION_SCHEMA.COLUMNS

) t1

WHERETABLE_NAME=@.MyTable AND IS_IDENITITY=1

|||Thank you very muchMotley

exactly what i was looking for.

Thanks

Monday, March 19, 2012

details on Linked server?

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar Balasubramanian
Hi
See reply to later post..
John
"sasikumar" wrote:

> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directly
> to an oracle server. So that I can directly access data's from Oracle using
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

details on Linked server?

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar BalasubramanianHi
See reply to later post..
John
"sasikumar" wrote:
> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directly
> to an oracle server. So that I can directly access data's from Oracle using
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

details on Linked server?

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar BalasubramanianHi
See reply to later post..
John
"sasikumar" wrote:

> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directl
y
> to an oracle server. So that I can directly access data's from Oracle usin
g
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

details on Linked server setup

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar Balasubramanian
Hi
There is an example using the Microsoft Driver in sp_addlinked server
http://msdn.microsoft.com/library/de...adda_8gqa.asp.
Depending on the driver you are using you may also need to install SQL*NET
etc..
This article gives the steps required:
http://support.microsoft.com/default...b;en-us;280106
Oracle OLEDB drivers can be found at
http://www.oracle.com/technology/sof..._db/index.html
John
"sasikumar" wrote:

> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directly
> to an oracle server. So that I can directly access data's from Oracle using
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

details on Linked server setup

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar BalasubramanianHi
There is an example using the Microsoft Driver in sp_addlinked server
a_8gqa.asp." target="_blank">http://msdn.microsoft.com/library/d.../>
a_8gqa.asp.
Depending on the driver you are using you may also need to install SQL*NET
etc..
This article gives the steps required:
http://support.microsoft.com/defaul...kb;en-us;280106
Oracle OLEDB drivers can be found at
http://www.oracle.com/technology/so...e_db/index.html
John
"sasikumar" wrote:

> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directl
y
> to an oracle server. So that I can directly access data's from Oracle usin
g
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

details on Linked server setup

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar BalasubramanianHi
There is an example using the Microsoft Driver in sp_addlinked server
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_adda_8gqa.asp.
Depending on the driver you are using you may also need to install SQL*NET
etc..
This article gives the steps required:
http://support.microsoft.com/default.aspx?scid=kb;en-us;280106
Oracle OLEDB drivers can be found at
http://www.oracle.com/technology/software/tech/windows/ole_db/index.html
John
"sasikumar" wrote:
> Hi,
> Any one know about Linked server setup in sql server.
> I want to know more detail on setting up a sqlserver to connect it directly
> to an oracle server. So that I can directly access data's from Oracle using
> Stored procedure.
>
> Regards,
> Sasikumar Balasubramanian
>
>

Details on Linked server

Hi,
Any one know about Linked server setup in sql server.
I want to know more detail on setting up a sqlserver to connect it directly
to an oracle server. So that I can directly access data's from Oracle using
Stored procedure.
Regards,
Sasikumar Balasubramanianhttp://msdn.microsoft.com/library/d... />
a_8gqa.asp
There's an example there on how to create a link to an Oracle server.
ML
http://milambda.blogspot.com/

Sunday, March 11, 2012

detaching a db in sql 6

greeting ya all,
I was just wondering of how to detach a database in sqlserver 6? is
it the transerfer tool'
MTIA,
GrawshaNow, this was a whole ago, but...
That would be the DROP DATABASE command. SQL Server didn't actually removed the disk devices in the
old architecture when you did DROP DATABASE (you created those devices explicitly and a device can
be shared among several databases).
The hard part is to do "attach", which involves DISK REINIT and DISK REFIT, something you really
only use for emergency recovery.
I suggest you save yourself *a lot* of trouble and do DUMP and LOAD (backup/(restore). And even that
is a lot harder in the old architecture, so make sure you read up on the subject if needed.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<grawsha2000@.yahoo.com> wrote in message
news:1170433784.946975.181760@.v45g2000cwv.googlegroups.com...
> greeting ya all,
> I was just wondering of how to detach a database in sqlserver 6? is
> it the transerfer tool'
> MTIA,
> Grawsha
>|||Add on to Tibor, In SQL 6.0 the best option to copy a database to one server
to another server will DUMP the database
and use LOAD Database in the destination server to Restore the database.
In SQL 6.0 there is no concept of files, all were devices and database will
reside above the devices.
Thanks
Hari
"grawsha2000@.yahoo.com" wrote:
> greeting ya all,
> I was just wondering of how to detach a database in sqlserver 6? is
> it the transerfer tool'
> MTIA,
> Grawsha
>

detaching a db in sql 6

greeting ya all,
I was just wondering of how to detach a database in sqlserver 6? is
it the transerfer tool'
MTIA,
GrawshaNow, this was a whole ago, but...
That would be the DROP DATABASE command. SQL Server didn't actually removed
the disk devices in the
old architecture when you did DROP DATABASE (you created those devices expli
citly and a device can
be shared among several databases).
The hard part is to do "attach", which involves DISK REINIT and DISK REFIT,
something you really
only use for emergency recovery.
I suggest you save yourself *a lot* of trouble and do DUMP and LOAD (backup/
(restore). And even that
is a lot harder in the old architecture, so make sure you read up on the sub
ject if needed.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<grawsha2000@.yahoo.com> wrote in message
news:1170433784.946975.181760@.v45g2000cwv.googlegroups.com...
> greeting ya all,
> I was just wondering of how to detach a database in sqlserver 6? is
> it the transerfer tool'
> MTIA,
> Grawsha
>|||Add on to Tibor, In SQL 6.0 the best option to copy a database to one server
to another server will DUMP the database
and use LOAD Database in the destination server to Restore the database.
In SQL 6.0 there is no concept of files, all were devices and database will
reside above the devices.
Thanks
Hari
"grawsha2000@.yahoo.com" wrote:

> greeting ya all,
> I was just wondering of how to detach a database in sqlserver 6? is
> it the transerfer tool'
> MTIA,
> Grawsha
>

Friday, February 17, 2012

Design Issue

I posted this also in the Visual Basic section:

I'm working with: VB6 and SqlServer 2000

I'm creating an application that requires users to answer several questions and based on answers to those questions, certain conditions result, such as the ability to view certain sections of the questionaire and/or more questions appear and/or some questions become irrelavent and/or mathematical formulas work one way or another based on an answer to a question.

Here is an example:
The user has to answer a question. For this particular question, if the user chooses Yes then I must "Activate" all of the questions that are flagged with the code X. If the user chooses No then I must "Activate" all of the questions that are flagged with Y and "Deactivate" all of the questions that are flagged with Z.

I'm coming across a design issue (both with the application itself and the database). What is the best way to store all of this in a database? Should I store the questions along with the list of possible answers and their corresponding conditions in the database as well as the actual data for each record (each questionaire)? Should I be referencing the database to populate all of my questions on my VB form or should I manually put labels and combo boxes containing the questions and possible answers on my form? Or should I be using another technology to store my questions and conditions OR my results, such as XML?

I looking for suggestions. I want to optimize my program as much as possible. I don't want to slow it down by making several calls to the database, but I want to make sure I'm also taking away optimization by hardcoding everything.

Thanks for your time and help!Should I store the questions along with the list of possible answers and their corresponding conditions in the database as well as the actual data for each record (each questionaire)? Should I be referencing the database to populate all of my questions on my VB form or should I manually put labels and combo boxes containing the questions and possible answers on my form?
I would always choose storing reference data in a database over hard-coding in the application.|||blindman,

thanks for responding. i had a feeling that would be the best option. i'm still a bit confused on how to logically put everything in the database.

MORE INFO:

Picture an application with an explorer style view. On the left in folders are different sections of a questionaire. On the right side will be the corresponding questions to that section. Each section, each question and it's corresponding possible answers, the controls that they will be held in (VB) will all need to be in the database. I'm still confused on how to setup tables relating each part...There is the data that will be stored to set up the screen, then there is data that will be stored for each record (each questionaire's answers, so to speak).

Thanks again!|||questionaire
section
question
answers
...but what do you mean , "the controls that they will be held in (VB) will all need to be in the database"? I hope you are just referring to the lookup lists...|||i think i was thinking too much. Seeing your code example has helped me clear up a lot. Thank you!...I was adding in a bunch of tables that didn't need to be there. The structure above makes a lot more sense, and will work with all of the lookup tables that I'll need. Again Thank you!...it always helps to have another set of eyes looking at the same issue.|||Again Thank you!...it always helps to have another set of eyes looking at the same issue. blind ones at that