Showing posts with label exist. Show all posts
Showing posts with label exist. Show all posts

Thursday, March 22, 2012

Classpath

Hi everybody

I have been trying to compile a servlet. When i try
import javax.servlet.*

I get the compilation error " javax.servlet does not exist"

I have tomcat installed. I understand that i have to make some change in the classpath. I have servlet-api.jar and also jsp-api.jar. But i don't have classpath variable in my environment variables.

Any suggestiions!!!!!!!!!!!!!

thanksYou are totally in a wrong place vmiharia ... We only talk databases here ...

Originally posted by vmiharia
Hi everybody

I have been trying to compile a servlet. When i try
import javax.servlet.*

I get the compilation error " javax.servlet does not exist"

I have tomcat installed. I understand that i have to make some change in the classpath. I have servlet-api.jar and also jsp-api.jar. But i don't have classpath variable in my environment variables.

Any suggestiions!!!!!!!!!!!!!

thankssqlsql

Sunday, February 19, 2012

Checking if CHECK Constraints exist

Hi,

How do I check if a check constraint on a table already exists or not?

Thank you.

see the Books Online for more information on INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE|||Thank you...

Checking if a login exist

I need to find out how to check if a login already exists on the SQL server. I cant find the method to do this. If anyone can help me I would be grateful.select * from master..syslogins where name = ...|||Thank you

Thursday, February 16, 2012

Checking for Existence of File fails during validation

OK. Here's my situation. I check for the existence of a dummy .txt file using a script. I send an e-mail if it does not exist and exit package. The .txt file only exists if another .xls file is present which I import. However, during the validation phase of the package, the package fails because the .xls file does not exist. Is there a way to bypass the validation step? The only solution I came up with is to have a two-step job. The first runs the file check step and sends the e-mail. The second attemps to run the package and fails. Not a very graceful exit.

In your package, make the first task a script task that checks to see if the file exists. If it does, set a package variable to indicate that it does exist. Connect that script task to the data flow task with a Success constraint. Double-click the constraint and add an expression that evaluates to True if the variable indicates that the file exists. On your data flow task, set the DelayValidation property to True.

Let me know if you need additional details.

|||

Thanks for the quick response. I actually didn't use a variable, just some control flow controls to send an e-mail if the first file doesn't exist; I'll try to integrate your suggestion on setting the variables in the future. The trick for me was the delay validation flag on the data flow. Thanks again.

Tuesday, February 14, 2012

CHECKDB and Object ID 0

Can someone please tell me what "Object ID 0" is? It does not exist in
sysobjects and I can find a reference in BOL or in the groups/forums...
I am trying to anlyze the first line returned from DBCC CHECKDB
Server: Msg 8909, Level 16, State 1, Line 1
Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
the page header = (0:120).
Thanks!Hi Dave
Error 8909 is documented in Books Online which advises to check for hardware
problems and then restore from a good back.
John
"Dave" wrote:

> Can someone please tell me what "Object ID 0" is? It does not exist in
> sysobjects and I can find a reference in BOL or in the groups/forums...
> I am trying to anlyze the first line returned from DBCC CHECKDB
> Server: Msg 8909, Level 16, State 1, Line 1
> Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
> the page header = (0:120).
> Thanks!
>|||Yes, I saw that. We had a hard drive fail in a Raid 5 array.
I am planning on doing the restore today, but I would still like to
know what object "ojbect id 0" is. Any ideas?
John Bell wrote:[vbcol=seagreen]
> Hi Dave
> Error 8909 is documented in Books Online which advises to check for hardwa
re
> problems and then restore from a good back.
> John
> "Dave" wrote:
>|||Yes, I saw that. We had a hard drive fail in a Raid 5 array.
I am planning on doing the restore today, but I would still like to
know what object "ojbect id 0" is. Any ideas?
John Bell wrote:[vbcol=seagreen]
> Hi Dave
> Error 8909 is documented in Books Online which advises to check for hardwa
re
> problems and then restore from a good back.
> John
> "Dave" wrote:
>|||Hi Dave
I believe it is corrupted data.
John
"Dave" wrote:

> Yes, I saw that. We had a hard drive fail in a Raid 5 array.
> I am planning on doing the restore today, but I would still like to
> know what object "ojbect id 0" is. Any ideas?
>
> John Bell wrote:
>

CHECKDB and Object ID 0

Can someone please tell me what "Object ID 0" is? It does not exist in
sysobjects and I can find a reference in BOL or in the groups/forums...
I am trying to anlyze the first line returned from DBCC CHECKDB
Server: Msg 8909, Level 16, State 1, Line 1
Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
the page header = (0:120).
Thanks!Hi Dave
Error 8909 is documented in Books Online which advises to check for hardware
problems and then restore from a good back.
John
"Dave" wrote:
> Can someone please tell me what "Object ID 0" is? It does not exist in
> sysobjects and I can find a reference in BOL or in the groups/forums...
> I am trying to anlyze the first line returned from DBCC CHECKDB
> Server: Msg 8909, Level 16, State 1, Line 1
> Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
> the page header = (0:120).
> Thanks!
>|||Yes, I saw that. We had a hard drive fail in a Raid 5 array.
I am planning on doing the restore today, but I would still like to
know what object "ojbect id 0" is. Any ideas?
John Bell wrote:
> Hi Dave
> Error 8909 is documented in Books Online which advises to check for hardware
> problems and then restore from a good back.
> John
> "Dave" wrote:
> > Can someone please tell me what "Object ID 0" is? It does not exist in
> > sysobjects and I can find a reference in BOL or in the groups/forums...
> >
> > I am trying to anlyze the first line returned from DBCC CHECKDB
> >
> > Server: Msg 8909, Level 16, State 1, Line 1
> > Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
> > the page header = (0:120).
> >
> > Thanks!
> >
> >|||Yes, I saw that. We had a hard drive fail in a Raid 5 array.
I am planning on doing the restore today, but I would still like to
know what object "ojbect id 0" is. Any ideas?
John Bell wrote:
> Hi Dave
> Error 8909 is documented in Books Online which advises to check for hardware
> problems and then restore from a good back.
> John
> "Dave" wrote:
> > Can someone please tell me what "Object ID 0" is? It does not exist in
> > sysobjects and I can find a reference in BOL or in the groups/forums...
> >
> > I am trying to anlyze the first line returned from DBCC CHECKDB
> >
> > Server: Msg 8909, Level 16, State 1, Line 1
> > Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
> > the page header = (0:120).
> >
> > Thanks!
> >
> >|||Hi Dave
I believe it is corrupted data.
John
"Dave" wrote:
> Yes, I saw that. We had a hard drive fail in a Raid 5 array.
> I am planning on doing the restore today, but I would still like to
> know what object "ojbect id 0" is. Any ideas?
>
> John Bell wrote:
> > Hi Dave
> >
> > Error 8909 is documented in Books Online which advises to check for hardware
> > problems and then restore from a good back.
> >
> > John
> >
> > "Dave" wrote:
> >
> > > Can someone please tell me what "Object ID 0" is? It does not exist in
> > > sysobjects and I can find a reference in BOL or in the groups/forums...
> > >
> > > I am trying to anlyze the first line returned from DBCC CHECKDB
> > >
> > > Server: Msg 8909, Level 16, State 1, Line 1
> > > Table error: Object ID 0, index ID 0, page ID (1:23953). The PageId in
> > > the page header = (0:120).
> > >
> > > Thanks!
> > >
> > >
>

Friday, February 10, 2012

Check the field existence of a database table

Check the field existence of a database table, if exist get the type, size, decimal ..etc attributes

I need SP

SP

(

@.Tablename varchar(30),

@.Fieldname varchar(30),

@.existance char(1) OUTPUT,

@.field_type varchar(30) OUTPUT,

@.field_size int OUTPUT,

@.field_decimal int OUTPUT

)

as

/* Below check the existance of a @.Fieldname in given @.Tablename */

/* And set the OUTPUT variables */

Thanks

To check existance of a data column, try code below:

IFEXISTS (SELECT *FROMSysObjects soINNERJOINSysColumns scON so.ID = sc.IDWHEREObjectProperty(so.ID,'IsUserTable') = 1AND so.Name ='yourtablename'AND sc.Name ='columnname' )

To get datatype of the data column, try:

SELECT data_typeFROM information_schema.columnsWHERE table_schema ='dbo'AND table_name ='yourtablename'AND column_name ='columnname'
|||

You can also do an sp_Help 'Table' to get all the information.

|||

Hi jackyang,

Thanks for your help.Your first query is running properly but second one has problem

SELECT data_typeFROM information_schema.columnsWHERE table_schema ='dbo'AND table_name ='yourtablename'AND column_name ='columnname'
 does not work
here is 'dbo' static or my databas name (my database name is 'neuron')?
Thanks
|||

You can disregard the table_schema then. It's likely the security schema is not default 'dbo' in your setup.

Just use the code below:

SELECT data_typeFROM information_schema.columnsWHERE table_name ='yourtablename'AND column_name ='columnname'