Showing posts with label hii. Show all posts
Showing posts with label hii. Show all posts

Wednesday, March 21, 2012

how to find the unique key and foreign key reference given the table name in MS SQL

hii...
i m trying to find the Unique key and the foreign key reference in MS-SQL.
plz any one advice me how to do this.
thank u.
radhamohan

Quote:

Originally Posted by radhamohan

hii...
i m trying to find the Unique key and the foreign key reference in MS-SQL.
plz any one advice me how to do this.
thank u.
radhamohan


Hi. You will need to explain this in much more detail. Not sure what you mean by 'reference'sql

Monday, March 12, 2012

How to find out whether a report is being generated ON-DEMAND or ON-SCHEDULE?

Hi:

I would like to find out if there is any way of telling a particular report is executed by a user-click event or fired by a schedule event.

Here are my two use-cases:

1. We want fire different custom methods in ON-DEMAND and ON-SCHEDULE executions

2. On the final report, we want to show "This report is generated ON-DEMAND by user X" or "This report is generated ON-SCHEDULE"

Please let me know,

Thanks

Yared

You can look in the ReportServer DB ExecutionLog table where the username is recorded.

how to find out what sqlserver i am running

Hi:
I am taking over a existing sqlserver.
The sqlserver is working fine.
Is there a way to find out whether the prev guy installed
sqlserver standard edition or
sqlserver developer edition or
sqlserver personal edition
may be
from registry or active log msg during boot up or
using select @.@.version from system table etc.
thanks a million for your valuable time to answer.
Mike,
If you check the output of SELECT @.@.VERSION , it would mention the SQLServer
edition in the last line.For example, I see:
....
"Enterprise Edition on Windows ..."
Or you can simply do SELECT SERVERPROPERTY('EDITION')
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:CFA71390-27A4-407B-9232-A4BDE3F9E856@.microsoft.com...
> Hi:
> I am taking over a existing sqlserver.
> The sqlserver is working fine.
> Is there a way to find out whether the prev guy installed
> sqlserver standard edition or
> sqlserver developer edition or
> sqlserver personal edition
> may be
> from registry or active log msg during boot up or
> using select @.@.version from system table etc.
>
> thanks a million for your valuable time to answer.
>
|||http://www.aspfaq.com/2160
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:CFA71390-27A4-407B-9232-A4BDE3F9E856@.microsoft.com...
> Hi:
> I am taking over a existing sqlserver.
> The sqlserver is working fine.
> Is there a way to find out whether the prev guy installed
> sqlserver standard edition or
> sqlserver developer edition or
> sqlserver personal edition
> may be
> from registry or active log msg during boot up or
> using select @.@.version from system table etc.
>
> thanks a million for your valuable time to answer.
>

how to find out what sqlserver i am running

Hi:
I am taking over a existing sqlserver.
The sqlserver is working fine.
Is there a way to find out whether the prev guy installed
sqlserver standard edition or
sqlserver developer edition or
sqlserver personal edition
may be
from registry or active log msg during boot up or
using select @.@.version from system table etc.
thanks a million for your valuable time to answer.Mike,
If you check the output of SELECT @.@.VERSION , it would mention the SQLServer
edition in the last line.For example, I see:
...
"Enterprise Edition on Windows ..."
Or you can simply do SELECT SERVERPROPERTY('EDITION')
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:CFA71390-27A4-407B-9232-A4BDE3F9E856@.microsoft.com...
> Hi:
> I am taking over a existing sqlserver.
> The sqlserver is working fine.
> Is there a way to find out whether the prev guy installed
> sqlserver standard edition or
> sqlserver developer edition or
> sqlserver personal edition
> may be
> from registry or active log msg during boot up or
> using select @.@.version from system table etc.
>
> thanks a million for your valuable time to answer.
>|||http://www.aspfaq.com/2160
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:CFA71390-27A4-407B-9232-A4BDE3F9E856@.microsoft.com...
> Hi:
> I am taking over a existing sqlserver.
> The sqlserver is working fine.
> Is there a way to find out whether the prev guy installed
> sqlserver standard edition or
> sqlserver developer edition or
> sqlserver personal edition
> may be
> from registry or active log msg during boot up or
> using select @.@.version from system table etc.
>
> thanks a million for your valuable time to answer.
>

How to find out what rows are not in a table

Hi

I have a problem where I must compair an import table with a local datatable and import rows that are missing and correct the rows that are different.

How to best do this?

I was hoping to avoid cursors

thanks

Walter

hi

what is simple is just refer to the database

and get the rows from current db and insert the sam in target database

use not in clause in source Db so u can take out the duplicates

I hope u ll be geting it right

TechiTawa

|||

walter_verhoeven wrote:

Hi

I have a problem where I must compair an import table with a local datatable and import rows that are missing and correct the rows that are different.

How to best do this?

I was hoping to avoid cursors

thanks

Walter

you need an upsert (update /insert) statement

unfortunately upsert is not a supported keyowrd in sql server right now but

there are work around.

see this links

http://sudheerpalyam.spaces.live.com/Blog/cns!1pKCMhBsSwPMevqFfdi-3JgQ!198.entry

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=58353

Friday, March 9, 2012

how to find out column name with sql server store procedure

Hi
I have table which has Fields A,B,C and D for example. is thier any way to
retrive these field column as inline table function or store procedure.
thanks
some thing like select column_name from xxxx
thanksUSE pubs
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'autho
rs'
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"amjad" <amjad@.discussions.microsoft.com> wrote in message
news:B4AEB01C-6652-4681-AE71-6842385E4E17@.microsoft.com...
> Hi
> I have table which has Fields A,B,C and D for example. is thier any way to
> retrive these field column as inline table function or store procedure.
> thanks
> some thing like select column_name from xxxx
> thanks
>|||Or get it all in one variable with this technique:
USE pubs
GO
DECLARE @.fields VARCHAR(1000)
SELECT @.fields = ISNULL( @.fields, '' ) + column_name + ', '
FROM INFORMATION_SCHEMA.columns
WHERE table_name = 'authors'
-- Trim trailing space and comma
SET @.fields = SUBSTRING( @.fields, 1, LEN( @.fields) -1 )
SELECT @.fields
-- sp_columns gives some useful information too.
EXEC sp_columns 'authors'
"Tibor Karaszi" wrote:

> USE pubs
> SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'aut
hors'
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "amjad" <amjad@.discussions.microsoft.com> wrote in message
> news:B4AEB01C-6652-4681-AE71-6842385E4E17@.microsoft.com...
>
>

Wednesday, March 7, 2012

how to find invalid objects --After DDL changes

Hi

I have a SQL Server 2005 database running. When I run some ddl changes, I want to find all the procs/objects that get invalidated because of object not found error.....

Is there any way that I can look up in sysdepends or other tables to find information about this.

Regards

Imtiaz

You can query the system view sys.syscomments for any procedures or functions that reference the objects. The text of each is stored in sys.syscomments.text.

How to find filegroups for a given Table and Table's indexes

Hi

I am using SQL Server 2005 Developer Edition.

I want a list of the following things from the database: -

Table Name , FileGroup Table resides on

Table Name, Index Name, FileGroup index resides on

To put it simply, consider the following example:-

Lets say I have a table XYZ in my database created on Filegroup F1. It has a PK PK1 nonclustered index on Filegroup F2.

List1

-

XYZ F1

List2

XYZ PK1 F2

Please do not tell me of sp_help <table> option

Regards

Imtiaz

For the table XYZ

select OBJECT_NAME(i.object_id) [Table_Name], ds.name [Filegroup_Name] from sys.indexes i join sys.filegroups ds on (ds.data_space_id=i.data_space_id) where object_name(i.object_id) = 'XYZ' and i.index_id=0

--This will work when the table does not have any clustered index on it.

For the non clustered index,

select OBJECT_NAME(i.object_id) [Table_Name], i.name [Index_Name], ds.name [Filegroup_name] from sys.indexes i join sys.filegroups ds on (ds.data_space_id=i.data_space_id) where object_name(i.object_id) = 'XYZ' and i.name='PK1'

For more such catalog view queries

http://msdn2.microsoft.com/en-us/library/ms345522.aspx

How to find duplicates

Hi
I assume that some of you do this on a regular basis, so I hope you can
help.
We're currently in the process of merging 2 databases into 1. Therefore I
need to do some clean up of the data, and get rid of duplicate records in
some tables. It might be very simple to do this with some TSQL code, but I
just can't figure out to do it.
It will be fine just to test on one column in the table, and what I'd like
so get is some code that can show me all the records where there's more than
one record with the same value in that column in the table.
I hope that some of you can guide me in the right direction...
Regards
Steen
Here's an example from Pubs. Authors with duplicate last names:
SELECT A. au_id, A.au_lname, A.au_fname
FROM Authors AS A
JOIN
(SELECT au_lname
FROM Authors
GROUP BY au_lname
HAVING COUNT(*)>1) AS B
ON A.au_lname = B.au_lname
David Portas
SQL Server MVP
|||Thanks a lot David. That seems to be what I needed.
Regards
Steen
David Portas wrote:
> Here's an example from Pubs. Authors with duplicate last names:
> SELECT A. au_id, A.au_lname, A.au_fname
> FROM Authors AS A
> JOIN
> (SELECT au_lname
> FROM Authors
> GROUP BY au_lname
> HAVING COUNT(*)>1) AS B
> ON A.au_lname = B.au_lname
> --
> David Portas
> SQL Server MVP

Friday, February 24, 2012

How to find and delete orphan users in all db on server?

Hi
I need help ;)
How to find orphan users in all databases on sql server 2000 and delete
them in one script or in any automated or semi automated way ?
I try do it using sp_MSforeachdb sp_change_users_login 'Report' but i
did't succeded. Probably i'm not experienced enough to complete this
task by myself.
Maybe you know sites with such a usfull scripts ?
Thanks
M.
See, if the queries from my article help:
http://vyaskn.tripod.com/troubleshoo...phan_users.htm
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"marta" <grupy_d@.go2.pl> wrote in message
news:1123684712.782296.155920@.g47g2000cwa.googlegr oups.com...
> Hi
> I need help ;)
> How to find orphan users in all databases on sql server 2000 and delete
> them in one script or in any automated or semi automated way ?
> I try do it using sp_MSforeachdb sp_change_users_login 'Report' but i
> did't succeded. Probably i'm not experienced enough to complete this
> task by myself.
> Maybe you know sites with such a usfull scripts ?
> Thanks
> M.
>

How to find and delete orphan users in all db on server?

Hi
I need help ;)
How to find orphan users in all databases on sql server 2000 and delete
them in one script or in any automated or semi automated way ?
I try do it using sp_MSforeachdb sp_change_users_login 'Report' but i
did't succeded. Probably i'm not experienced enough to complete this
task by myself.
Maybe you know sites with such a usfull scripts ?
Thanks
M.See, if the queries from my article help:
http://vyaskn.tripod.com/troublesho...rphan_users.htm
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"marta" <grupy_d@.go2.pl> wrote in message
news:1123684712.782296.155920@.g47g2000cwa.googlegroups.com...
> Hi
> I need help ;)
> How to find orphan users in all databases on sql server 2000 and delete
> them in one script or in any automated or semi automated way ?
> I try do it using sp_MSforeachdb sp_change_users_login 'Report' but i
> did't succeded. Probably i'm not experienced enough to complete this
> task by myself.
> Maybe you know sites with such a usfull scripts ?
> Thanks
> M.
>

how to find an object ?!

hi
i forget completely
how to find an object in sql 2005 ?
don't remember where is that function !!?
where is it ?!!
thanks
--
atte,
HernnHi
USE AdventureWorks
GO
SELECT * FROM sys.objects
"bajopalabra" <bajopalabra@.hotmail.com> wrote in message
news:%23yZNlqn$GHA.1556@.TK2MSFTNGP03.phx.gbl...
> hi
> i forget completely
> how to find an object in sql 2005 ?
> don't remember where is that function !!?
> where is it ?!!
> thanks
> --
> atte,
> Hernn
>|||You can query catalog view sys.all_objects
Linchi
"bajopalabra" wrote:

> hi
> i forget completely
> how to find an object in sql 2005 ?
> don't remember where is that function !!?
> where is it ?!!
> thanks
> --
> atte,
> Hernán
>
>|||is not there an "object finder" ?
mhhh... where i seen it, then ... sql 2000 has one ?
atte,
Hernn
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi en el mensaje
news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
| You can query catalog view sys.all_objects
|
| Linchi
|
| "bajopalabra" wrote:
|
| > hi
| > i forget completely
| > how to find an object in sql 2005 ?
| > don't remember where is that function !!?
| > where is it ?!!
| > thanks
| > --
| > atte,
| > Hernn
| >
| >
| >|||In Management Studio, you can find an object using the "Filter"
feature. This option is available when you right click an object type
(one of Tables / Views / Stored Procedures).
In Query Analyzer there was another feature, called "Object Search"
(F4). This feature is not present in Management Studio. See:
https://connect.microsoft.com/SQLSe...aspx?Feedback=
ID=3D124498
Razvan
bajopalabra wrote:
> is not there an "object finder" ?
> mhhh... where i seen it, then ... sql 2000 has one ?
> --
> atte,
> Hern=E1n
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi=F3 en el men=
saje
> news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
> | You can query catalog view sys.all_objects
> |
> | Linchi
> |
> | "bajopalabra" wrote:
> |
> | > hi
> | > i forget completely
> | > how to find an object in sql 2005 ?
> | > don't remember where is that function !!?
> | > where is it ?!!
> | > thanks
> | > --=20
> | > atte,
> | > Hern=E1n
> | >
> | >
> | >|||yes, that is !
atte,
Hernn
"Razvan Socol" <rsocol@.gmail.com> escribi en el mensaje
news:1162480405.660966.290330@.e3g2000cwe.googlegroups.com...
In Management Studio, you can find an object using the "Filter"
feature. This option is available when you right click an object type
(one of Tables / Views / Stored Procedures).
In Query Analyzer there was another feature, called "Object Search"
(F4). This feature is not present in Management Studio. See:
https://connect.microsoft.com/SQLSe...=1244
98
Razvan
bajopalabra wrote:
> is not there an "object finder" ?
> mhhh... where i seen it, then ... sql 2000 has one ?
> --
> atte,
> Hernn
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi en el
mensaje
> news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
> | You can query catalog view sys.all_objects
> |
> | Linchi
> |
> | "bajopalabra" wrote:
> |
> | > hi
> | > i forget completely
> | > how to find an object in sql 2005 ?
> | > don't remember where is that function !!?
> | > where is it ?!!
> | > thanks
> | > --
> | > atte,
> | > Hernn
> | >
> | >
> | >

how to find an object ?!

hi
i forget completely
how to find an object in sql 2005 ?
don't remember where is that function !!?
where is it ?!!
thanks
atte,
Hernn
Hi
USE AdventureWorks
GO
SELECT * FROM sys.objects
"bajopalabra" <bajopalabra@.hotmail.com> wrote in message
news:%23yZNlqn$GHA.1556@.TK2MSFTNGP03.phx.gbl...
> hi
> i forget completely
> how to find an object in sql 2005 ?
> don't remember where is that function !!?
> where is it ?!!
> thanks
> --
> atte,
> Hernn
>
|||You can query catalog view sys.all_objects
Linchi
"bajopalabra" wrote:

> hi
> i forget completely
> how to find an object in sql 2005 ?
> don't remember where is that function !!?
> where is it ?!!
> thanks
> --
> atte,
> Hernán
>
>
|||is not there an "object finder" ?
mhhh... where i seen it, then ... sql 2000 has one ?
atte,
Hernn
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi en el mensaje
news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
| You can query catalog view sys.all_objects
|
| Linchi
|
| "bajopalabra" wrote:
|
| > hi
| > i forget completely
| > how to find an object in sql 2005 ?
| > don't remember where is that function !!?
| > where is it ?!!
| > thanks
| > --
| > atte,
| > Hernn
| >
| >
| >
|||In Management Studio, you can find an object using the "Filter"
feature. This option is available when you right click an object type
(one of Tables / Views / Stored Procedures).
In Query Analyzer there was another feature, called "Object Search"
(F4). This feature is not present in Management Studio. See:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124498
Razvan
bajopalabra wrote:
> is not there an "object finder" ?
> mhhh... where i seen it, then ... sql 2000 has one ?
> --
> atte,
> Hernn
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi en el mensaje
> news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
> | You can query catalog view sys.all_objects
> |
> | Linchi
> |
> | "bajopalabra" wrote:
> |
> | > hi
> | > i forget completely
> | > how to find an object in sql 2005 ?
> | > don't remember where is that function !!?
> | > where is it ?!!
> | > thanks
> | > --
> | > atte,
> | > Hernn
> | >
> | >
> | >
|||yes, that is !
atte,
Hernn
"Razvan Socol" <rsocol@.gmail.com> escribi en el mensaje
news:1162480405.660966.290330@.e3g2000cwe.googlegro ups.com...
In Management Studio, you can find an object using the "Filter"
feature. This option is available when you right click an object type
(one of Tables / Views / Stored Procedures).
In Query Analyzer there was another feature, called "Object Search"
(F4). This feature is not present in Management Studio. See:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124498
Razvan
bajopalabra wrote:
> is not there an "object finder" ?
> mhhh... where i seen it, then ... sql 2000 has one ?
> --
> atte,
> Hernn
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> escribi en el
mensaje
> news:FE167E6A-B5C3-4C9C-AAEE-DD8A6AF1C39B@.microsoft.com...
> | You can query catalog view sys.all_objects
> |
> | Linchi
> |
> | "bajopalabra" wrote:
> |
> | > hi
> | > i forget completely
> | > how to find an object in sql 2005 ?
> | > don't remember where is that function !!?
> | > where is it ?!!
> | > thanks
> | > --
> | > atte,
> | > Hernn
> | >
> | >
> | >