Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts

Tuesday, March 27, 2012

Filter by concatenated field

How can I filter a query using a cocatenated field? For instance, I have a
query (for instance):
Select id,
ClientCity + ' ' + ClientState + ' ' + ClientZip as ClientInfo
from tblClients
I want to be able to say "where ClientInfo like '% ' + @.Parameter + '%'"
so that I can query by "Chicago" or "60001" as parameters
Thanks for your help.The where clause is parsed before the select list, so you can't do that
because the optimizer won't know what you're talking about (or in rare
cases, you will be filtering on the wrong column, e.g. if you actually had a
clientInfo column with different information). A couple of options:
SELECT
id,
ClientInfo = ClientCity + ' ' + ClientState + ' ' + ClientZip
FROM
tblClients
WHERE
ClientCity + ' ' + ClientState + ' ' + ClientZip LIKE '%'+@.Parameter+'%'
or
SELECT
id,
ClientInfo
FROM
(
SELECT id,
ClientInfo = ClientCity + ' ' + ClientState + ' ' + ClientZip
FROM
tblClients
) subquery
WHERE
ClientInfo LIKE '%'+@.Parameter+'%'
"et" <eagletender2001@.yahoo.com> wrote in message
news:e7MI72JEGHA.524@.TK2MSFTNGP09.phx.gbl...
> How can I filter a query using a cocatenated field? For instance, I have
> a query (for instance):
> Select id,
> ClientCity + ' ' + ClientState + ' ' + ClientZip as ClientInfo
> from tblClients
> I want to be able to say "where ClientInfo like '% ' + @.Parameter + '%'"
> so that I can query by "Chicago" or "60001" as parameters
> Thanks for your help.
>
>

Wednesday, March 21, 2012

Files associated with SQL server

Hi all,
Is there any any to find the files that are associated with a SQL server Instance ? Does SQL server provide any API for that ?

Hi,

Each instance installs in a different directory. If you look at you default installation directory [C:\Program Files\Microsoft SQL Server], you will find a dierctory for each instance and for each feature (e.g. SSIS, SSAS, etc). These directories are called MSSQL.x, the x separating out the features and instances. So e.g. You have installed 2 instances of SQL Server, one of SSAS and one of SSRS, you directory structure would look something like:

C:\Program Files\Microsoft SQL Server\90 - SQL Binaries (SQL 2005).

C:\Program Files\Microsoft SQL Server\MSSQL.1 - SQL Database Engine Instance 1

C:\Program Files\Microsoft SQL Server\MSSQL.2 - SQL SSAS

C:\Program Files\Microsoft SQL Server\MSSQL.3 - SQL SSRS

C:\Program Files\Microsoft SQL Server\MSSQL.4 - SQL Database Engine Instance 2

There is nothing stopping users from moving these database files around so to check that you have the correct path you could execute

Code Snippet

select * from sys.database_files

from the instance and that will confirm the location of the database files.

|||

You can run OSQL (sql 2000) or SQLCMD (2005) command to get files details against a instance.

select *from sysaltfiles -- SQL Server 2000

select *From sys.master_files -- SQL Server 2005

Eg. (for SQL 2005)

C:>sqlcmd -SYourInstanceName -UUserName -PPassword -dMaster -q"Select Physical_Name From Sys.Master_Files"

Read more about SQLCMD in BOL (OSQL if its sql 2000)

Madhu

|||

Are you looking for user databases files, if refer to the Madhu's method in this case.

For all associated binary files then they are installed under Program Files (default installation) or any directory you might have chosen when installing as Custom.

|||Hi all,
Thanks for the reply.
Sorry all. I think i didnt post the question correctly.I want to know the files associated with the SQL server programmatically. I want to know whether microsoft provides any API for that or is there any other method to do the same ?
|||

Ah, yes. Have a look at SQL Server Management Objects (SMO), and I quote from BOL:

"SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server. SQL Server Replication Management Objects (RMO) is a collection of objects that encapsulates SQL Server replication management."

|||Hi
Thanks !!!. I will look into it.
|||

The above post is correct - and you can use this link at any time for the default locations:

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

The nice thing about the link is that it is kept up to date as things change.

- Buck Woody

Files associated with SQL server

Hi all,
Is there any any to find the files that are associated with a SQL server Instance ? Does SQL server provide any API for that ?

Hi,

Each instance installs in a different directory. If you look at you default installation directory [C:\Program Files\Microsoft SQL Server], you will find a dierctory for each instance and for each feature (e.g. SSIS, SSAS, etc). These directories are called MSSQL.x, the x separating out the features and instances. So e.g. You have installed 2 instances of SQL Server, one of SSAS and one of SSRS, you directory structure would look something like:

C:\Program Files\Microsoft SQL Server\90 - SQL Binaries (SQL 2005).

C:\Program Files\Microsoft SQL Server\MSSQL.1 - SQL Database Engine Instance 1

C:\Program Files\Microsoft SQL Server\MSSQL.2 - SQL SSAS

C:\Program Files\Microsoft SQL Server\MSSQL.3 - SQL SSRS

C:\Program Files\Microsoft SQL Server\MSSQL.4 - SQL Database Engine Instance 2

There is nothing stopping users from moving these database files around so to check that you have the correct path you could execute

Code Snippet

select * from sys.database_files

from the instance and that will confirm the location of the database files.

|||

You can run OSQL (sql 2000) or SQLCMD (2005) command to get files details against a instance.

select *from sysaltfiles -- SQL Server 2000

select *From sys.master_files -- SQL Server 2005

Eg. (for SQL 2005)

C:>sqlcmd -SYourInstanceName -UUserName -PPassword -dMaster -q"Select Physical_Name From Sys.Master_Files"

Read more about SQLCMD in BOL (OSQL if its sql 2000)

Madhu

|||

Are you looking for user databases files, if refer to the Madhu's method in this case.

For all associated binary files then they are installed under Program Files (default installation) or any directory you might have chosen when installing as Custom.

|||Hi all,
Thanks for the reply.
Sorry all. I think i didnt post the question correctly.I want to know the files associated with the SQL server programmatically. I want to know whether microsoft provides any API for that or is there any other method to do the same ?
|||

Ah, yes. Have a look at SQL Server Management Objects (SMO), and I quote from BOL:

"SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server. SQL Server Replication Management Objects (RMO) is a collection of objects that encapsulates SQL Server replication management."

|||Hi
Thanks !!!. I will look into it.
|||

The above post is correct - and you can use this link at any time for the default locations:

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

The nice thing about the link is that it is kept up to date as things change.

- Buck Woodysql

Files associated with SQL server

Hi all,
Is there any any to find the files that are associated with a SQL server Instance ? Does SQL server provide any API for that ?

Hi,

Each instance installs in a different directory. If you look at you default installation directory [C:\Program Files\Microsoft SQL Server], you will find a dierctory for each instance and for each feature (e.g. SSIS, SSAS, etc). These directories are called MSSQL.x, the x separating out the features and instances. So e.g. You have installed 2 instances of SQL Server, one of SSAS and one of SSRS, you directory structure would look something like:

C:\Program Files\Microsoft SQL Server\90 - SQL Binaries (SQL 2005).

C:\Program Files\Microsoft SQL Server\MSSQL.1 - SQL Database Engine Instance 1

C:\Program Files\Microsoft SQL Server\MSSQL.2 - SQL SSAS

C:\Program Files\Microsoft SQL Server\MSSQL.3 - SQL SSRS

C:\Program Files\Microsoft SQL Server\MSSQL.4 - SQL Database Engine Instance 2

There is nothing stopping users from moving these database files around so to check that you have the correct path you could execute

Code Snippet

select * from sys.database_files

from the instance and that will confirm the location of the database files.

|||

You can run OSQL (sql 2000) or SQLCMD (2005) command to get files details against a instance.

select *from sysaltfiles -- SQL Server 2000

select *From sys.master_files -- SQL Server 2005

Eg. (for SQL 2005)

C:>sqlcmd -SYourInstanceName -UUserName -PPassword -dMaster -q"Select Physical_Name From Sys.Master_Files"

Read more about SQLCMD in BOL (OSQL if its sql 2000)

Madhu

|||

Are you looking for user databases files, if refer to the Madhu's method in this case.

For all associated binary files then they are installed under Program Files (default installation) or any directory you might have chosen when installing as Custom.

|||Hi all,
Thanks for the reply.
Sorry all. I think i didnt post the question correctly.I want to know the files associated with the SQL server programmatically. I want to know whether microsoft provides any API for that or is there any other method to do the same ?
|||

Ah, yes. Have a look at SQL Server Management Objects (SMO), and I quote from BOL:

"SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server. SQL Server Replication Management Objects (RMO) is a collection of objects that encapsulates SQL Server replication management."

|||Hi
Thanks !!!. I will look into it.
|||

The above post is correct - and you can use this link at any time for the default locations:

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

The nice thing about the link is that it is kept up to date as things change.

- Buck Woody

Files associated with a DB

Hi all
Is there any way to find the files/filenames associated with the SQL server instance ?. Is there any way to find it programmatically ? Does Microsoft provide any API for that ?

Thanks in Adcance,
mani3727

Maybe you can use WMI.

See what you can list installed software

In another example you can List Specific Files Included in the Indexing Service

|||

Are you talking about binary files or database files?

If you are using SQL Server 2005 you can use the following code to get all databases related to the instance:

Code Snippet

SELECT * FROM sys.master_files

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||Hi Wesley

Thanks for the reply.I want to know all the files associated with a specific SQL server instance.Could you tell me how it can be done programmaically ?

Thanks,
mani3727

Files associated with a DB

Hi all
Is there any way to find the files/filenames associated with the SQL server instance ?. Is there any way to find it programmatically ? Does Microsoft provide any API for that ?

Thanks in Adcance,
mani3727

Maybe you can use WMI.

See what you can list installed software

In another example you can List Specific Files Included in the Indexing Service

|||

Are you talking about binary files or database files?

If you are using SQL Server 2005 you can use the following code to get all databases related to the instance:

Code Snippet

SELECT * FROM sys.master_files

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||Hi Wesley

Thanks for the reply.I want to know all the files associated with a specific SQL server instance.Could you tell me how it can be done programmaically ?

Thanks,
mani3727

Monday, March 19, 2012

Filegroup with SQL Server virtual server

What the best way to move a SQL Server 2000 virtual server with Austin_Sales
as the virtual server name and REPT as the name instance set but as a
non-filegroup. Create a new SQL Server 2000 virtual server with a named
instance get the data from Austin_Sales\REPT database into the new filegroup
database?
Thanks,
Restore will give you (essentially) a binary image of what is inside the
database. I.e., you cannot
change filegroup layout through backup/restore. You'd have to do that before
the backup or after the
restore...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
server name and REPT as the name instance. This is Active\Active Cluster with
Windows 2000 Advanced Server as the OS.
I have a new server and would like to have filegroups for the database.
Can I create filegroups on the new server and restore the backup from
Austin_Sales\REPT in the database with filegroups?
Please help me with this task.
Thanks,
That depends on what goal you are after with file groups. What are you
trying to accomplish?
Sincerely,
Anthony Thomas
"Joe K." wrote:

> What the best way to move a SQL Server 2000 virtual server with Austin_Sales
> as the virtual server name and REPT as the name instance set but as a
> non-filegroup. Create a new SQL Server 2000 virtual server with a named
> instance get the data from Austin_Sales\REPT database into the new filegroup
> database?
> Thanks,
>
> Restore will give you (essentially) a binary image of what is inside the
> database. I.e., you cannot
> change filegroup layout through backup/restore. You'd have to do that before
> the backup or after the
> restore...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Joe K." <JoeK@.discussions.microsoft.com> wrote in message
> news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
> I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
> server name and REPT as the name instance. This is Active\Active Cluster with
> Windows 2000 Advanced Server as the OS.
> I have a new server and would like to have filegroups for the database.
> Can I create filegroups on the new server and restore the backup from
> Austin_Sales\REPT in the database with filegroups?
> Please help me with this task.
> Thanks,
>

Filegroup with SQL Server virtual server

What the best way to move a SQL Server 2000 virtual server with Austin_Sales
as the virtual server name and REPT as the name instance set but as a
non-filegroup. Create a new SQL Server 2000 virtual server with a named
instance get the data from Austin_Sales\REPT database into the new filegroup
database?
Thanks,
Restore will give you (essentially) a binary image of what is inside the
database. I.e., you cannot
change filegroup layout through backup/restore. You'd have to do that before
the backup or after the
restore...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
server name and REPT as the name instance. This is Active\Active Cluster with
Windows 2000 Advanced Server as the OS.
I have a new server and would like to have filegroups for the database.
Can I create filegroups on the new server and restore the backup from
Austin_Sales\REPT in the database with filegroups?
Please help me with this task.
Thanks,That depends on what goal you are after with file groups. What are you
trying to accomplish?
Sincerely,
Anthony Thomas
"Joe K." wrote:
> What the best way to move a SQL Server 2000 virtual server with Austin_Sales
> as the virtual server name and REPT as the name instance set but as a
> non-filegroup. Create a new SQL Server 2000 virtual server with a named
> instance get the data from Austin_Sales\REPT database into the new filegroup
> database?
> Thanks,
>
> Restore will give you (essentially) a binary image of what is inside the
> database. I.e., you cannot
> change filegroup layout through backup/restore. You'd have to do that before
> the backup or after the
> restore...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Joe K." <JoeK@.discussions.microsoft.com> wrote in message
> news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
> I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
> server name and REPT as the name instance. This is Active\Active Cluster with
> Windows 2000 Advanced Server as the OS.
> I have a new server and would like to have filegroups for the database.
> Can I create filegroups on the new server and restore the backup from
> Austin_Sales\REPT in the database with filegroups?
> Please help me with this task.
> Thanks,
>

Filegroup with SQL Server virtual server

What the best way to move a SQL Server 2000 virtual server with Austin_Sales
as the virtual server name and REPT as the name instance set but as a
non-filegroup. Create a new SQL Server 2000 virtual server with a named
instance get the data from Austin_Sales\REPT database into the new filegroup
database?
Thanks,
Restore will give you (essentially) a binary image of what is inside the
database. I.e., you cannot
change filegroup layout through backup/restore. You'd have to do that before
the backup or after the
restore...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
server name and REPT as the name instance. This is Active\Active Cluster wit
h
Windows 2000 Advanced Server as the OS.
I have a new server and would like to have filegroups for the database.
Can I create filegroups on the new server and restore the backup from
Austin_Sales\REPT in the database with filegroups?
Please help me with this task.
Thanks,That depends on what goal you are after with file groups. What are you
trying to accomplish?
Sincerely,
Anthony Thomas
"Joe K." wrote:

> What the best way to move a SQL Server 2000 virtual server with Austin_Sal
es
> as the virtual server name and REPT as the name instance set but as a
> non-filegroup. Create a new SQL Server 2000 virtual server with a named
> instance get the data from Austin_Sales\REPT database into the new filegro
up
> database?
> Thanks,
>
> Restore will give you (essentially) a binary image of what is inside the
> database. I.e., you cannot
> change filegroup layout through backup/restore. You'd have to do that befo
re
> the backup or after the
> restore...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Joe K." <JoeK@.discussions.microsoft.com> wrote in message
> news:CFB09E6E-E210-4D53-B26E-98FFAC443E70@.microsoft.com...
> I have a SQL Server 2000 virtual server with Austin_Sales as the virtual
> server name and REPT as the name instance. This is Active\Active Cluster w
ith
> Windows 2000 Advanced Server as the OS.
> I have a new server and would like to have filegroups for the database.
> Can I create filegroups on the new server and restore the backup from
> Austin_Sales\REPT in the database with filegroups?
> Please help me with this task.
> Thanks,
>