Thursday, March 29, 2012
Determine Table's PK Columns
part of the primary key.
Example.
Code:
SELECT syscolumns.[name] FROM sysobjects,syscolumns,systypes WHERE
sysobjects.id=syscolumns.id AND systypes.xtype=syscolumns.xtype AND
sysobjects.name='tablename'
Yields all the column names. But I just want to see those that are part of
the primary key. How?
Ryan
> SELECT syscolumns.[name] FROM sysobjects,syscolumns,systypes WHERE
> sysobjects.id=syscolumns.id AND systypes.xtype=syscolumns.xtype AND
> sysobjects.name='tablename'
shuldn't you use information_schema?
.~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
/ v \
/( _ )\ (Ubuntu 5.10) Linux 2.6.14.3
^ ^ 22:37:07 up 9 days 2:31 load average: 3.12 1.63 0.80|||Try:
select
*
from
information_schema.constraint_column_usage
where
table_name = 'Order Details'
and objectproperty (object_id (constraint_name), 'IsPrimaryKey') = 1
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada tom@.cips.ca
www.pinpub.com
"Ryan" <Ryan@.discussions.microsoft.com> wrote in message
news:037F8848-C843-4A77-B385-6994E6235CDA@.microsoft.com...
>I want to do a query on a db's system tables to determine what column(s)
>are
> part of the primary key.
> Example.
> Code:
> SELECT syscolumns.[name] FROM sysobjects,syscolumns,systypes WHERE
> sysobjects.id=syscolumns.id AND systypes.xtype=syscolumns.xtype AND
> sysobjects.name='tablename'
> Yields all the column names. But I just want to see those that are part of
> the primary key. How?
> Ryan|||Thank you both of you. Yes, Man-wai Chang, the information_schema looks lik
e
it's a lot easier than joining the system tables like I was doing. Thank
you, both.
determine system database...
database through tsql?
The only tangible thing that I can see is dbid. however I would far rather a
database property to check in t-sql.
Thanks in advance,
M.
cannot get it to work.
smo throws exception when I create the database object.
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSyst emObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uytkownik "Mark B" <nospam@.nospam.com> napisa w wiadomoci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>
|||cannot get smo property to work!
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSyst emObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uytkownik "Mark B" <nospam@.nospam.com> napisa w wiadomoci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>
determine system database...
database through tsql?
The only tangible thing that I can see is dbid. however I would far rather a
database property to check in t-sql.
Thanks in advance,
M.Here is some idea.
Check how Microsoft guys are doing that. Build a simple application that
uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
for each database. Run Profiler and see how SMO is checking if the database
is a system database or not.
Regards
Pawel Potasinski
[http://www.potasinski.pl]
Uytkownik "Mark B" <nospam@.nospam.com> napisa w wiadomoci
news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
> what is the best way to determine if a database is actually a system
> database through tsql?
> The only tangible thing that I can see is dbid. however I would far rather
> a database property to check in t-sql.
> Thanks in advance,
> M.
>|||cannot get it to work.
smo throws exception when I create the database object.
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uytkownik "Mark B" <nospam@.nospam.com> napisa w wiadomoci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>|||To the best of my knowledge, there is no such property available anywhere. I
believe that even SMO
and DMO goes by the database name.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Mark B" <nospam@.nospam.com> wrote in message news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl..
.
> what is the best way to determine if a database is actually a system datab
ase through tsql?
> The only tangible thing that I can see is dbid. however I would far rather
a database property to
> check in t-sql.
> Thanks in advance,
> M.
>|||Exactly Tibor. More precisely - by they go by name for master, msdb, tempdb
and model but there's more. Distribution database for replication can have a
custom name and is also considered to be a system database so they also
check for the value of is_distributor column in sys.databases for each
database.
Regards
Pawel Potasinski
[http://www.potasinski.pl]
Uzytkownik "Tibor Karaszi"
<tibor_please.no.email_karaszi@.hotmail.nomail.com> napisal w wiadomosci
news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
> To the best of my knowledge, there is no such property available anywhere.
> I believe that even SMO and DMO goes by the database name.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Mark B" <nospam@.nospam.com> wrote in message
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>|||> so they also check for the value of is_distributor column in sys.databases
for each database.
Ahh, that's good to know. Thanks Pawel.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23oXeDGQPIHA.4272@.TK2MSFTNGP06.phx.gbl...
> Exactly Tibor. More precisely - by they go by name for master, msdb, tempd
b and model but there's
> more. Distribution database for replication can have a custom name and is
also considered to be a
> system database so they also check for the value of is_distributor column
in sys.databases for
> each database.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uzytkownik "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.c
om> napisal w wiadomosci
> news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
>|||cannot get smo property to work!
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uytkownik "Mark B" <nospam@.nospam.com> napisa w wiadomoci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>
determine system database...
database through tsql?
The only tangible thing that I can see is dbid. however I would far rather a
database property to check in t-sql.
Thanks in advance,
M.Here is some idea.
Check how Microsoft guys are doing that. Build a simple application that
uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
for each database. Run Profiler and see how SMO is checking if the database
is a system database or not.
--
Regards
Pawel Potasinski
[http://www.potasinski.pl]
U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
> what is the best way to determine if a database is actually a system
> database through tsql?
> The only tangible thing that I can see is dbid. however I would far rather
> a database property to check in t-sql.
> Thanks in advance,
> M.
>|||cannot get it to work.
smo throws exception when I create the database object.
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>|||To the best of my knowledge, there is no such property available anywhere. I believe that even SMO
and DMO goes by the database name.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Mark B" <nospam@.nospam.com> wrote in message news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
> what is the best way to determine if a database is actually a system database through tsql?
> The only tangible thing that I can see is dbid. however I would far rather a database property to
> check in t-sql.
> Thanks in advance,
> M.
>|||Exactly Tibor. More precisely - by they go by name for master, msdb, tempdb
and model but there's more. Distribution database for replication can have a
custom name and is also considered to be a system database so they also
check for the value of is_distributor column in sys.databases for each
database.
--
Regards
Pawel Potasinski
[http://www.potasinski.pl]
Uzytkownik "Tibor Karaszi"
<tibor_please.no.email_karaszi@.hotmail.nomail.com> napisal w wiadomosci
news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
> To the best of my knowledge, there is no such property available anywhere.
> I believe that even SMO and DMO goes by the database name.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Mark B" <nospam@.nospam.com> wrote in message
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>|||> so they also check for the value of is_distributor column in sys.databases for each database.
Ahh, that's good to know. Thanks Pawel.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23oXeDGQPIHA.4272@.TK2MSFTNGP06.phx.gbl...
> Exactly Tibor. More precisely - by they go by name for master, msdb, tempdb and model but there's
> more. Distribution database for replication can have a custom name and is also considered to be a
> system database so they also check for the value of is_distributor column in sys.databases for
> each database.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uzytkownik "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> napisal w wiadomosci
> news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
>> To the best of my knowledge, there is no such property available anywhere. I believe that even
>> SMO and DMO goes by the database name.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Mark B" <nospam@.nospam.com> wrote in message news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system database through tsql?
>> The only tangible thing that I can see is dbid. however I would far rather a database property
>> to check in t-sql.
>> Thanks in advance,
>> M.
>>
>|||cannot get smo property to work!
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>
Tuesday, March 27, 2012
Determine Report Permissions with T-SQL
ReportServerTempDB to determine which Active Directory groups have access to
which reports. I want to document what I would otherwise have to go
report-by-report in the Report Manager screen to see. I've looked at
several of the system tables (Users, DataSource, Policies, Roles,
ConfigurationInfo, Catalog) but have had no luck.You need to use the GetPolicies and SetPolicies methods on the web service.
You don't want to do anything directly to the database.
Here's a code snippet giving you an idea of how to use these methods:
private bool AddUserToFolderPolicy(string folder, string user, ref string
errMessage)
{
try
{
//Get the Browser role
Role[]roles = m_ReportingService.ListRoles();
Role browserRole = new Role();
foreach (Role r in roles)
{
if (r.Name == "Browser") browserRole = r;
break;
}
Role[] policyRoles = new Role[1];
policyRoles[0] = new Role();
policyRoles[0] =browserRole;
//Get the current policies of the folder in question
string path = "/" + folder;
bool inheritParent = false;
Policy[] currentPolicies = m_ReportingService.GetPolicies(path, out
inheritParent);
//If the user is currently in the current policy set just return
for(int i=0;i<currentPolicies.Length;i++)
if(currentPolicies[i].GroupUserName == user)
return true;
//Create the new policy array and add the new user
ArrayList arrPolicies = new ArrayList(currentPolicies);
Policy p = new Policy();
p.GroupUserName = user;
p.Roles = policyRoles;
arrPolicies.Add(p);
Policy[] finalPolicies = (Policy[])arrPolicies.ToArray(typeof(Policy));
//Set the policies
m_ReportingService.SetPolicies(path,finalPolicies);
}
catch (Exception e)
{
errMessage = e.Message;
return false;
}
return true;
}
Adrian M.
MCP
"Scott" <Scott@.discussions.microsoft.com> wrote in message
news:B4B65C16-C9C8-4872-85D9-C75BADC0F53D@.microsoft.com...
> Is there a way, using the system tables in the ReportServer or
> ReportServerTempDB to determine which Active Directory groups have access
> to
> which reports. I want to document what I would otherwise have to go
> report-by-report in the Report Manager screen to see. I've looked at
> several of the system tables (Users, DataSource, Policies, Roles,
> ConfigurationInfo, Catalog) but have had no luck.
>|||Adrian, thank you for the prompt reply. Unfortunately, I am not a C#
developer and need to accomplish this task in T-SQL. I don't really want to
"do" anything to the tables, I just want to "get" something from them, just
as I would a system table in master or anywhere else in SQL Server. Does
anyone ([MSFT] people perhaps?) know if this is possible or if there is any
documentation on how to navigate these tables?
"Adrian M." wrote:
> You need to use the GetPolicies and SetPolicies methods on the web service.
> You don't want to do anything directly to the database.
> Here's a code snippet giving you an idea of how to use these methods:
> private bool AddUserToFolderPolicy(string folder, string user, ref string
> errMessage)
> {
> try
> {
> //Get the Browser role
> Role[]roles = m_ReportingService.ListRoles();
> Role browserRole = new Role();
> foreach (Role r in roles)
> {
> if (r.Name == "Browser") browserRole = r;
> break;
> }
> Role[] policyRoles = new Role[1];
> policyRoles[0] = new Role();
> policyRoles[0] =browserRole;
> //Get the current policies of the folder in question
> string path = "/" + folder;
> bool inheritParent = false;
> Policy[] currentPolicies = m_ReportingService.GetPolicies(path, out
> inheritParent);
> //If the user is currently in the current policy set just return
> for(int i=0;i<currentPolicies.Length;i++)
> if(currentPolicies[i].GroupUserName == user)
> return true;
> //Create the new policy array and add the new user
> ArrayList arrPolicies = new ArrayList(currentPolicies);
> Policy p = new Policy();
> p.GroupUserName = user;
> p.Roles = policyRoles;
> arrPolicies.Add(p);
> Policy[] finalPolicies = (Policy[])arrPolicies.ToArray(typeof(Policy));
> //Set the policies
> m_ReportingService.SetPolicies(path,finalPolicies);
> }
> catch (Exception e)
> {
> errMessage = e.Message;
> return false;
> }
> return true;
> }
>
> --
> Adrian M.
> MCP
> "Scott" <Scott@.discussions.microsoft.com> wrote in message
> news:B4B65C16-C9C8-4872-85D9-C75BADC0F53D@.microsoft.com...
> > Is there a way, using the system tables in the ReportServer or
> > ReportServerTempDB to determine which Active Directory groups have access
> > to
> > which reports. I want to document what I would otherwise have to go
> > report-by-report in the Report Manager screen to see. I've looked at
> > several of the system tables (Users, DataSource, Policies, Roles,
> > ConfigurationInfo, Catalog) but have had no luck.
> >
>
>|||Microsoft doesn't support directly access to the Report Server DB (including
queries). Supported access is through the tools provided (Report Manager,
web service, etc...)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsadmin/htm/arp_dbadmin_v1_4915.asp
--
Adrian M.
MCP
"Scott" <Scott@.discussions.microsoft.com> wrote in message
news:CDD9B6BC-38D9-400C-B905-D184949D0E91@.microsoft.com...
> Adrian, thank you for the prompt reply. Unfortunately, I am not a C#
> developer and need to accomplish this task in T-SQL. I don't really want
> to
> "do" anything to the tables, I just want to "get" something from them,
> just
> as I would a system table in master or anywhere else in SQL Server. Does
> anyone ([MSFT] people perhaps?) know if this is possible or if there is
> any
> documentation on how to navigate these tables?
> "Adrian M." wrote:
>> You need to use the GetPolicies and SetPolicies methods on the web
>> service.
>> You don't want to do anything directly to the database.
>> Here's a code snippet giving you an idea of how to use these methods:
>> private bool AddUserToFolderPolicy(string folder, string user, ref
>> string
>> errMessage)
>> {
>> try
>> {
>> //Get the Browser role
>> Role[]roles = m_ReportingService.ListRoles();
>> Role browserRole = new Role();
>> foreach (Role r in roles)
>> {
>> if (r.Name == "Browser") browserRole = r;
>> break;
>> }
>> Role[] policyRoles = new Role[1];
>> policyRoles[0] = new Role();
>> policyRoles[0] =browserRole;
>> //Get the current policies of the folder in question
>> string path = "/" + folder;
>> bool inheritParent = false;
>> Policy[] currentPolicies = m_ReportingService.GetPolicies(path, out
>> inheritParent);
>> //If the user is currently in the current policy set just return
>> for(int i=0;i<currentPolicies.Length;i++)
>> if(currentPolicies[i].GroupUserName == user)
>> return true;
>> //Create the new policy array and add the new user
>> ArrayList arrPolicies = new ArrayList(currentPolicies);
>> Policy p = new Policy();
>> p.GroupUserName = user;
>> p.Roles = policyRoles;
>> arrPolicies.Add(p);
>> Policy[] finalPolicies =>> (Policy[])arrPolicies.ToArray(typeof(Policy));
>> //Set the policies
>> m_ReportingService.SetPolicies(path,finalPolicies);
>> }
>> catch (Exception e)
>> {
>> errMessage = e.Message;
>> return false;
>> }
>> return true;
>> }
>>
>> --
>> Adrian M.
>> MCP
>> "Scott" <Scott@.discussions.microsoft.com> wrote in message
>> news:B4B65C16-C9C8-4872-85D9-C75BADC0F53D@.microsoft.com...
>> > Is there a way, using the system tables in the ReportServer or
>> > ReportServerTempDB to determine which Active Directory groups have
>> > access
>> > to
>> > which reports. I want to document what I would otherwise have to go
>> > report-by-report in the Report Manager screen to see. I've looked at
>> > several of the system tables (Users, DataSource, Policies, Roles,
>> > ConfigurationInfo, Catalog) but have had no luck.
>> >
>>|||Even if we were to document the tables, there is no way to use TSQL to get
this (without some extended SPs). We use Windows APIs to resolve group
membership and determine effective permissions from the ACL we store in the
database.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Scott" <Scott@.discussions.microsoft.com> wrote in message
news:CDD9B6BC-38D9-400C-B905-D184949D0E91@.microsoft.com...
> Adrian, thank you for the prompt reply. Unfortunately, I am not a C#
> developer and need to accomplish this task in T-SQL. I don't really want
> to
> "do" anything to the tables, I just want to "get" something from them,
> just
> as I would a system table in master or anywhere else in SQL Server. Does
> anyone ([MSFT] people perhaps?) know if this is possible or if there is
> any
> documentation on how to navigate these tables?
> "Adrian M." wrote:
>> You need to use the GetPolicies and SetPolicies methods on the web
>> service.
>> You don't want to do anything directly to the database.
>> Here's a code snippet giving you an idea of how to use these methods:
>> private bool AddUserToFolderPolicy(string folder, string user, ref
>> string
>> errMessage)
>> {
>> try
>> {
>> //Get the Browser role
>> Role[]roles = m_ReportingService.ListRoles();
>> Role browserRole = new Role();
>> foreach (Role r in roles)
>> {
>> if (r.Name == "Browser") browserRole = r;
>> break;
>> }
>> Role[] policyRoles = new Role[1];
>> policyRoles[0] = new Role();
>> policyRoles[0] =browserRole;
>> //Get the current policies of the folder in question
>> string path = "/" + folder;
>> bool inheritParent = false;
>> Policy[] currentPolicies = m_ReportingService.GetPolicies(path, out
>> inheritParent);
>> //If the user is currently in the current policy set just return
>> for(int i=0;i<currentPolicies.Length;i++)
>> if(currentPolicies[i].GroupUserName == user)
>> return true;
>> //Create the new policy array and add the new user
>> ArrayList arrPolicies = new ArrayList(currentPolicies);
>> Policy p = new Policy();
>> p.GroupUserName = user;
>> p.Roles = policyRoles;
>> arrPolicies.Add(p);
>> Policy[] finalPolicies =>> (Policy[])arrPolicies.ToArray(typeof(Policy));
>> //Set the policies
>> m_ReportingService.SetPolicies(path,finalPolicies);
>> }
>> catch (Exception e)
>> {
>> errMessage = e.Message;
>> return false;
>> }
>> return true;
>> }
>>
>> --
>> Adrian M.
>> MCP
>> "Scott" <Scott@.discussions.microsoft.com> wrote in message
>> news:B4B65C16-C9C8-4872-85D9-C75BADC0F53D@.microsoft.com...
>> > Is there a way, using the system tables in the ReportServer or
>> > ReportServerTempDB to determine which Active Directory groups have
>> > access
>> > to
>> > which reports. I want to document what I would otherwise have to go
>> > report-by-report in the Report Manager screen to see. I've looked at
>> > several of the system tables (Users, DataSource, Policies, Roles,
>> > ConfigurationInfo, Catalog) but have had no luck.
>> >
>>
Determine If Table Has Identity Field
an identity column?
Derek HartSELECT OBJECTPROPERTY(OBJECT_ID('tablename'), 'TableHasIdentity');
See OBJECTPROPERTY in Books Online for more information.
"Derek Hart" <derekmhart@.yahoo.com> wrote in message
news:%23fatw1GcGHA.3380@.TK2MSFTNGP04.phx.gbl...
> Is there a way to read a system table to determine if a specific table has
> an identity column?
> Derek Hart
>|||Use the OBJECTPROPERTY() function for this (tip: TableHasIdentity).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Derek Hart" <derekmhart@.yahoo.com> wrote in message news:%23fatw1GcGHA.3380@.TK2MSFTNGP04.p
hx.gbl...
> Is there a way to read a system table to determine if a specific table has
an identity column?
> Derek Hart
>|||Derek Hart wrote:
> Is there a way to read a system table to determine if a specific table has
> an identity column?
> Derek Hart
Always state what version you are using.
In 2000:
...
EXISTS
(SELECT *
FROM dbo.syscolumns AS C
WHERE id = OBJECT_ID('dbo.tablename')
AND COLUMNPROPERTY(id,name,'IsIdentity')=1) ;
In 2005:
...
EXISTS
(SELECT *
FROM sys.identity_columns
WHERE object_id = OBJECT_ID('dbo.tablename')) ;
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||In SQL Server 2005:
SELECT 'yes'
WHERE EXISTS
(
SELECT *
FROM sys.columns
WHERE
object_id = object_id('yourtablename')
AND is_identity = 1
)
In SQL Server 2000:
SELECT 'yes'
WHERE EXISTS
(
SELECT *
FROM syscolumns
WHERE
id = object_id('yourtablename')
AND COLUMNPROPERTY(id, name, 'IsIdentity') = 1
)
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Derek Hart" <derekmhart@.yahoo.com> wrote in message
news:%23fatw1GcGHA.3380@.TK2MSFTNGP04.phx.gbl...
> Is there a way to read a system table to determine if a specific table has
> an identity column?
> Derek Hart
>|||Nice, now we have many ways to do it:
2000 / 2005:
OBJECTPROPERTY
2000 (and 2005 via the compatability view):
COLUMNPROPERTY over the syscolumns table
2005 only:
Is_Identity from the sys.columns view
sys.Identity_Columns view (that's one I've missed until now -- thanks for
pointing it out, David)
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1146852429.607871.92140@.v46g2000cwv.googlegroups.com...
> Derek Hart wrote:
> Always state what version you are using.
> In 2000:
> ...
> EXISTS
> (SELECT *
> FROM dbo.syscolumns AS C
> WHERE id = OBJECT_ID('dbo.tablename')
> AND COLUMNPROPERTY(id,name,'IsIdentity')=1) ;
> In 2005:
> ...
> EXISTS
> (SELECT *
> FROM sys.identity_columns
> WHERE object_id = OBJECT_ID('dbo.tablename')) ;
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
Monday, March 19, 2012
Detailed User Access Rights
In our system, we only really have one main user, the SA user. Thats the
user that is used to do all the reads & writes for our application. Works
fine.
A problem arises when our customers want to have access to the DB. Now, we
want to control this so they cant go hacking up thier data and blaming us, s
o
we only allow read only access for report writings etc.
Now our customers are interested in writing views & user defined functions
etc, but we cant seem to find a way to allow users access to create / mod /
delete views & user defined functions, and NOT create / mod / delete DB
tables.
Any ideas / suggestions?
Thanks!> In our system, we only really have one main user, the SA user. Thats the
> user that is used to do all the reads & writes for our application. Works
> fine.
Although this works, it doesn't make it right. The Best Practice in SQL
Server is to never use 'sa' for routine database access.
> Now our customers are interested in writing views & user defined functions
> etc, but we cant seem to find a way to allow users access to create / mod
> /
> delete views & user defined functions, and NOT create / mod / delete DB
> tables.
You can allow users to create objects in only their own schema by granting
the desired object create permissions. Note that only privileged users
(sysdamin, dbo, db_owner and db_ddladmin) can create objects owned by other
users or the 'dbo' schema. Consequently, you could grant CREATE TABLE as
well without compromising data in tables owned by other users.
GRANT
CREATE VIEW,
CREATE FUNCTION
TO CustomerUser
If those user objects reference your application tables, SELECT permissions
on those tables will be needed.
Hope this helps.
Dan Guzman
SQL Server MVP
"-Ldwater" <Ldwater@.discussions.microsoft.com> wrote in message
news:7C2D9969-BBEF-4469-982B-5AC3B5307656@.microsoft.com...
> Hi all, I have a question about user access in MS-SQL.
> In our system, we only really have one main user, the SA user. Thats the
> user that is used to do all the reads & writes for our application. Works
> fine.
> A problem arises when our customers want to have access to the DB. Now,
> we
> want to control this so they cant go hacking up thier data and blaming us,
> so
> we only allow read only access for report writings etc.
> Now our customers are interested in writing views & user defined functions
> etc, but we cant seem to find a way to allow users access to create / mod
> /
> delete views & user defined functions, and NOT create / mod / delete DB
> tables.
> Any ideas / suggestions?
> Thanks!|||Excellent! Thats just what I needed! Tried it out, and it works just fine
:D
But while were on the subject, could I ask a few more questions?
1) You say that using the SA admin isn't the best way of access the DB
through our application. Is there a specific reason why this is bad?
2) Now that my customers can create their own views etc, I need them to be
able to access user defined functions created by the application. How do I
allow exe permissions on these functions to allow all users to execute them?
Thanks again!
"Dan Guzman" wrote:
> Although this works, it doesn't make it right. The Best Practice in SQL
> Server is to never use 'sa' for routine database access.
>
> You can allow users to create objects in only their own schema by granting
> the desired object create permissions. Note that only privileged users
> (sysdamin, dbo, db_owner and db_ddladmin) can create objects owned by othe
r
> users or the 'dbo' schema. Consequently, you could grant CREATE TABLE as
> well without compromising data in tables owned by other users.
> GRANT
> CREATE VIEW,
> CREATE FUNCTION
> TO CustomerUser
> If those user objects reference your application tables, SELECT permission
s
> on those tables will be needed.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "-Ldwater" <Ldwater@.discussions.microsoft.com> wrote in message
> news:7C2D9969-BBEF-4469-982B-5AC3B5307656@.microsoft.com...
>
>|||> 1) You say that using the SA admin isn't the best way of access the DB
> through our application. Is there a specific reason why this is bad?
For routine application database access, it's best to use an account with no
more permissions than actually needed. Using 'sa' or a sysadmin role member
account is overkill unless your app requires that level of security.
Sysadmin role members have full SQL Server permissions and OS permissions
are limited only by the SQL Server service account.
> 2) Now that my customers can create their own views etc, I need them to be
> able to access user defined functions created by the application. How do
> I
> allow exe permissions on these functions to allow all users to execute
> them?
You can GRANT EXECUTE or SELECT, depending on whether the function is scalar
or table-valued.
GRANT SELECT ON MyTableFunction TO CustomerUser
GRANT EXECUTE ON MyScalarFunction TO CustomerUser
Hope this helps.
Dan Guzman
SQL Server MVP
"-Ldwater" <Ldwater@.discussions.microsoft.com> wrote in message
news:95E53960-B58A-4125-B298-430AAAC1191D@.microsoft.com...[vbcol=seagreen]
> Excellent! Thats just what I needed! Tried it out, and it works just
> fine :D
> But while were on the subject, could I ask a few more questions?
> 1) You say that using the SA admin isn't the best way of access the DB
> through our application. Is there a specific reason why this is bad?
> 2) Now that my customers can create their own views etc, I need them to be
> able to access user defined functions created by the application. How do
> I
> allow exe permissions on these functions to allow all users to execute
> them?
> Thanks again!
> "Dan Guzman" wrote:
>|||Right.. i've added those & all is well.
Just as a closing thought.. is there any way I can declare a 'grant' command
to ALL users, current & future?
Its more than likely that once a view / function has been made, it could be
used by other SQL users that will require access, and even though we control
the number of SQL users, it makes more sence to make a function 'global' /
'public' rather than having to recode to add a new user each time we decide
to add one.
Thanks!|||The Best Practice is to create database roles and grant object permissions
only to roles. You can then control access via role membership. This
greatly simplifies security administration.
Hope this helps.
Dan Guzman
SQL Server MVP
"-Ldwater" <Ldwater@.discussions.microsoft.com> wrote in message
news:6F88596D-0A1A-47FB-B56D-9E37EFF3CC94@.microsoft.com...
> Right.. i've added those & all is well.
> Just as a closing thought.. is there any way I can declare a 'grant'
> command
> to ALL users, current & future?
> Its more than likely that once a view / function has been made, it could
> be
> used by other SQL users that will require access, and even though we
> control
> the number of SQL users, it makes more sence to make a function 'global' /
> 'public' rather than having to recode to add a new user each time we
> decide
> to add one.
> Thanks!
Detaching system databases...
MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
options om SQL Server 2000 but it's saying "Can't detach
system databases". Am I missing a step?
Do I need to end all connections?
Thanks,
Todd
Why are you detaching the system databases? Are you planning on moving them
to another server? Here is some information about moving system databases,
that might help.
http://support.microsoft.com/default...&Product=sql2k
----
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections?
> Thanks,
> Todd
|||Ugh, you can go through everything in KB #224071 and cross your fingers that
it all works well. Or, you can detach your *user* databases (or hopefully
you already have valid backups you can simply restore), uninstall SQL
Server, and then reinstall - placing the data directory where you should
have.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections?
> Thanks,
> Todd
|||I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
=20
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>http://support.microsoft.com/default...24071&Product=
=3Dsql2k
>--=20
>---=
--
>---=
--
>--
>Need SQL Server Examples check out my website at
>http://www.geocities.com/sqlserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>
>.
>
|||>> I reinstall would not be bad but I would prefer not to;)
Why? It's much cleaner, IMHO.
|||KB 224071, which Aaron suggested, describes moving files for system databases.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<anonymous@.discussions.microsoft.com> wrote in message news:f40501c43dc5$006531a0$a101280a@.phx.gbl...
I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>http://support.microsoft.com/default...&Product=sql2k
>--
>----
>----
>--
>Need SQL Server Examples check out my website at
>http://www.geocities.com/sqlserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>
>.
>
Detaching system databases...
MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
options om SQL Server 2000 but it's saying "Can't detach
system databases". Am I missing a step?
Do I need to end all connections'
Thanks,
ToddWhy are you detaching the system databases? Are you planning on moving them
to another server? Here is some information about moving system databases,
that might help.
http://support.microsoft.com/default.aspx?scid=kb;en-us;224071&Product=sql2k
--
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections'
> Thanks,
> Todd|||Ugh, you can go through everything in KB #224071 and cross your fingers that
it all works well. Or, you can detach your *user* databases (or hopefully
you already have valid backups you can simply restore), uninstall SQL
Server, and then reinstall - placing the data directory where you should
have.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections'
> Thanks,
> Todd|||I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>http://support.microsoft.com/default.aspx?scid=3Dkb;en-us;224071&Product=
=3Dsql2k
>-- >---=--
>---=--
>--
>Need SQL Server Examples check out my website at
>http://www.geocities.com/sqlserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>> I need to detach (in order to move the datafiles) MASTER,
>> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
>> options om SQL Server 2000 but it's saying "Can't detach
>> system databases". Am I missing a step?
>> Do I need to end all connections'
>> Thanks,
>> Todd
>
>.
>|||>> I reinstall would not be bad but I would prefer not to;)
Why? It's much cleaner, IMHO.|||KB 224071, which Aaron suggested, describes moving files for system databases.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<anonymous@.discussions.microsoft.com> wrote in message news:f40501c43dc5$006531a0$a101280a@.phx.gbl...
I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>http://support.microsoft.com/default.aspx?scid=kb;en-us;224071&Product=sql2k
>--
>----
>----
>--
>Need SQL Server Examples check out my website at
>http://www.geocities.com/sqlserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>> I need to detach (in order to move the datafiles) MASTER,
>> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
>> options om SQL Server 2000 but it's saying "Can't detach
>> system databases". Am I missing a step?
>> Do I need to end all connections'
>> Thanks,
>> Todd
>
>.
>
Detaching system databases...
MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
options om SQL Server 2000 but it's saying "Can't detach
system databases". Am I missing a step?
Do I need to end all connections'
Thanks,
ToddWhy are you detaching the system databases? Are you planning on moving them
to another server? Here is some information about moving system databases,
that might help.
http://support.microsoft.com/defaul...1&Product=sql2k
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections'
> Thanks,
> Todd|||Ugh, you can go through everything in KB #224071 and cross your fingers that
it all works well. Or, you can detach your *user* databases (or hopefully
you already have valid backups you can simply restore), uninstall SQL
Server, and then reinstall - placing the data directory where you should
have.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
> I need to detach (in order to move the datafiles) MASTER,
> MSDB, MODEL, TEMPDB. I am using EM and the sp_detach
> options om SQL Server 2000 but it's saying "Can't detach
> system databases". Am I missing a step?
> Do I need to end all connections'
> Thanks,
> Todd|||I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
=20
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>http://support.microsoft.com/defaul...224071&Product=
=3Dsql2k
>--=20
>---=
--
>---=
--
>--
>Need SQL Server Examples check out my website at
>http://www.geocities.com/sqlserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>
>.
>|||>> I reinstall would not be bad but I would prefer not to;)
Why? It's much cleaner, IMHO.|||KB 224071, which Aaron suggested, describes moving files for system database
s.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<anonymous@.discussions.microsoft.com> wrote in message news:f40501c43dc5$006
531a0$a101280a@.phx.gbl...
I want to move the datafiles because I put them on the C:\
(only 3GB) by mistake when I installed the SQL Server. I
want to move everything to another drive with 50GB+. I
have moved the user databases successfully but the system
databases don't want to go.
I reinstall would not be bad but I would prefer not to;)
>--Original Message--
>Why are you detaching the system databases? Are you
planning on moving them
>to another server? Here is some information about moving
system databases,
>that might help.
>]
>--
>----
-
>----
-
>--
>Need SQL Server Examples check out my website at
>[url]http://www.geocities.com/sqlserverexamples" target="_blank">http://support.microsoft.com/defaul...lserverexamples
>"Todd" <anonymous@.discussions.microsoft.com> wrote in message
>news:f1c901c43db7$4ed332f0$a401280a@.phx.gbl...
>
>.
>
Friday, March 9, 2012
Detach and Attach functions in SQL Server 2005
Hi,
I'm trying to port my ASP.NET web application to the production system.
I'm connection to the SQL Server 2005 instance on my hosting server via CTP. I've uploaded the .mdf and .ldf files of my DB via FTP to the hosting server, and then tried to attach using this command:
use master gosp_attach_db'tgp','F:\webspace\disk20\db\TGP.mdf','F:\webspace\disk20\db\TGP_log.ldf' go
but then there is an error (obviously) stating that I don't have permissions to create a database in database master.
I must admit that I'm prettycluelessin this area. My hostingservicesalready created a "place holder" for my database (tgp), but I don't know how to proceed from here in order attach the database files in the production environment. Is this something I can do myself, or must I involve the hosting services?
Thanks,
Alon
sp_attach_db requires the same permissions as CREATE DATABASE - so you're likely not going to be able to do this (if so, let me know who your host is - I could use the free/extra space they'd let me set up *grin*).You'll either need to contact them and have them hook up your DB, or look into using user-instance/attachable SQL Express functionality.|||
You have two options just backup your database and use management studio to restore your database on the host SQL Server after you have registered the host SQL Server in your management studio. In the backup and restore wizard choose the restore from device option. The other option is try the thread below for Attach database code modify it for your needs and use it. Hope this helps.
http://forums.asp.net/thread/981274.aspx
|||Thak you for your reply.
I tried to backup/restore, but when I tried to point to the location of the backup file (on the remote server), got the error message that I'm not authorized... I've just sent a request from the hosting firm to handle this.
I have a general question: what are the guidelines when moving from the test/development system to the production system? I couldn't find any article summarizing the process.
Thank you,
Alon
Yep, this helps
Alon
Wednesday, March 7, 2012
Desktop SQL can't install; SAPWD switch needed
setup, I get a prompt: A strong SA password is required for security
reasons. Please use SAPWD switch to supply the same.
The readme files really doesnt explain how I should go into any type of
explanation (like Administrative Tools in ControlPanel, etc) and set up a
system admin config for this.you must run the programm in the command prompt
then supply the necessary parameters
1. start>run>cmd
2. cd\msdeinstaller
3. setup/? for help
4. use the sapassword switch
"Bubba" wrote:
> I'm trying to install MSDE sql on my windows xp-pro system, but when runni
ng
> setup, I get a prompt: A strong SA password is required for security
> reasons. Please use SAPWD switch to supply the same.
> The readme files really doesnt explain how I should go into any type of
> explanation (like Administrative Tools in ControlPanel, etc) and set up a
> system admin config for this.
>
>|||setup.exe sapwd='1qQ123456Aa'
"jose g. de jesus jr mcp, mcdba" wrote:
> you must run the programm in the command prompt
> then supply the necessary parameters
> 1. start>run>cmd
> 2. cd\msdeinstaller
> 3. setup/? for help
> 4. use the sapassword switch
>
> "Bubba" wrote:
>
Desktop platform support for SQL Server Compact Edition?
I am doing some technology research for a new app and was wondering about the desktop operating system support for SQL Server compact edition. This app has a PC component and a mobile component, and both need to be data enabled, with syncronization between the PC and the mobile device.
So it seems like SSCE would be a good fit. Just run the SSCE client on both the PC and the device. But in the system requirements for SSCE it only gives XP as a valid desktop OS...
Is that correct? Obviously, desktop platform support for a production app will need to be broader than just XP.
Will SSCE desktop run on Win98,Win2000,XP Home, and Vista?
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
|||
Jo?o Paulo Figueira wrote:
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
Hi Joao-
Thanks a lot for that info. Is there any way you can publish the URL to that list - there may be other useful info on that page?
Also, I notice Windows Mobile 6.0 is not on the supported operating systems list? Is there any estimate on when that will be supported?
|||Here's the link. Although not explicitly stated, I don't believe you will have problems running on Windows Mobile 6.|||On Windows Mobile 6.0, SQL Compact 3.1 is included in ROM.
Desktop platform support for SQL Server Compact Edition?
I am doing some technology research for a new app and was wondering about the desktop operating system support for SQL Server compact edition. This app has a PC component and a mobile component, and both need to be data enabled, with syncronization between the PC and the mobile device.
So it seems like SSCE would be a good fit. Just run the SSCE client on both the PC and the device. But in the system requirements for SSCE it only gives XP as a valid desktop OS...
Is that correct? Obviously, desktop platform support for a production app will need to be broader than just XP.
Will SSCE desktop run on Win98,Win2000,XP Home, and Vista?
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
|||
Jo?o Paulo Figueira wrote:
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
Hi Joao-
Thanks a lot for that info. Is there any way you can publish the URL to that list - there may be other useful info on that page?
Also, I notice Windows Mobile 6.0 is not on the supported operating systems list? Is there any estimate on when that will be supported?
|||Here's the link. Although not explicitly stated, I don't believe you will have problems running on Windows Mobile 6.|||On Windows Mobile 6.0, SQL Compact 3.1 is included in ROM.
Desktop platform support for SQL Server Compact Edition?
I am doing some technology research for a new app and was wondering about the desktop operating system support for SQL Server compact edition. This app has a PC component and a mobile component, and both need to be data enabled, with syncronization between the PC and the mobile device.
So it seems like SSCE would be a good fit. Just run the SSCE client on both the PC and the device. But in the system requirements for SSCE it only gives XP as a valid desktop OS...
Is that correct? Obviously, desktop platform support for a production app will need to be broader than just XP.
Will SSCE desktop run on Win98,Win2000,XP Home, and Vista?
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
|||
Jo?o Paulo Figueira wrote:
From my own experience, XP Home and Vista are supported. The official support list is:
Supported Operating Systems: Windows 2000 Service Pack 4; Windows CE; Windows Mobile 2003 software for Pocket PCs; Windows Mobile 5.0; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 R2 Datacenter Edition (32-Bit x86); Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003, Datacenter Edition (32-bit x86); Windows Server 2003, Standard Edition (32-bit x86); Windows XP Home Edition ; Windows XP Media Center Edition; Windows XP Professional Edition ; Windows XP Service Pack 2; Windows XP Tablet PC Edition
Hi Joao-
Thanks a lot for that info. Is there any way you can publish the URL to that list - there may be other useful info on that page?
Also, I notice Windows Mobile 6.0 is not on the supported operating systems list? Is there any estimate on when that will be supported?
|||Here's the link. Although not explicitly stated, I don't believe you will have problems running on Windows Mobile 6.|||On Windows Mobile 6.0, SQL Compact 3.1 is included in ROM.
Saturday, February 25, 2012
Designing inventory system
Hi
Good Day!
I am designing a database to manage an Inventory system. I have two tables in it - Receives and Issues with two common fields -ProductID and Quantity.
I need some facilities in the database -
# Current Stock - Two fields - ProductID & BalanceQty. I want to get the balance quantity for a given product.
# Product Ledger - I want to have a ledger of product transaction with Date, ReceiveQty, IssueQty, Balance.
How can I have these facilities? Should I use a SProc or View? I need some expert openion. Please give me some details example. I am very new in SQLServer.
Thnk you very much!
Regards
Kapalic
Your question isn't really very clear to me, but it is really down to what you are using the data for. I would say stored procedure if this is used in a user interface (particularly in a single location), or a view if you want to be able to access the data in multiple locations, or perhaps for ad-hoc access...I am in favor of using stored procedures for all access to the database in your user interfaces to make things easier to maintain and use.|||
I agree with Louis. A stored procedure will be easier to maintain and easier to secure.
You definitely want the [CurrentStock].[BalanceQty] values to be dynamically calculated -and not static data stored in a table.
|||You can use a stroed procedure where you can pass the ProductId & you can get the BalanceQty & other details - it should be handy
|||Thnx guys for ur answers. Actually I couldn't make myself clear.
Can anyone please give me an example how to write these sprocs? I need to check if enough product exist in the receive table before issueing a product in the issue table.
Thnx!
|||If you mean protecting against over promising stock, if the tables are in the same database, I would use two techniques:
1. Stored procedure to calculate available stock when the user asks for the list (like when a user of Amazon goes to the page of a product and it says they have 3 in stock
2. A trigger that prevents an order from being placed without stock being available.
The second one will be a bit, because you will likely want to let the user backorder a product, but your order item for a product should be clearly marked as that, so the user doesn't get stuck waiting forever. So the calculation of available stock must take into consideration:
1. Will this product be stocked again (status of the product)
2. It there stock to cover the order now, even if there was when the user chose to order it, if not reject the line item, unless the user has specifically said "okay to back order"
But I would use a trigger to make sure that the status of the line item matched the expectation of order.
|||Thnx Buddys!
I've written a view to show all the product with current stocks (PurchaseQty - IssueQty - DamageQty). And a sproc to wrap the view.
But I can't get an way to show a ledger for individual products, like -
Date Product PurchaseQty IssueQty DamageQty BalanceQty
Regards
Kapalic
|||Use a WHERE clause, passing in the ProductID -both in the stored procedure and the VIEW.
Very similar to the code we wrote for you last week.
Designing inventory system
Hi
Good Day!
I am designing a database to manage an Inventory system. I have two tables in it - Receives and Issues with two common fields -ProductID and Quantity.
I need some facilities in the database -
# Current Stock - Two fields - ProductID & BalanceQty. I want to get the balance quantity for a given product.
# Product Ledger - I want to have a ledger of product transaction with Date, ReceiveQty, IssueQty, Balance.
How can I have these facilities? Should I use a SProc or View? I need some expert openion. Please give me some details example. I am very new in SQLServer.
Thnk you very much!
Regards
Kapalic
Your question isn't really very clear to me, but it is really down to what you are using the data for. I would say stored procedure if this is used in a user interface (particularly in a single location), or a view if you want to be able to access the data in multiple locations, or perhaps for ad-hoc access...I am in favor of using stored procedures for all access to the database in your user interfaces to make things easier to maintain and use.|||
I agree with Louis. A stored procedure will be easier to maintain and easier to secure.
You definitely want the [CurrentStock].[BalanceQty] values to be dynamically calculated -and not static data stored in a table.
|||You can use a stroed procedure where you can pass the ProductId & you can get the BalanceQty & other details - it should be handy
|||Thnx guys for ur answers. Actually I couldn't make myself clear.
Can anyone please give me an example how to write these sprocs? I need to check if enough product exist in the receive table before issueing a product in the issue table.
Thnx!
|||If you mean protecting against over promising stock, if the tables are in the same database, I would use two techniques:
1. Stored procedure to calculate available stock when the user asks for the list (like when a user of Amazon goes to the page of a product and it says they have 3 in stock
2. A trigger that prevents an order from being placed without stock being available.
The second one will be a bit, because you will likely want to let the user backorder a product, but your order item for a product should be clearly marked as that, so the user doesn't get stuck waiting forever. So the calculation of available stock must take into consideration:
1. Will this product be stocked again (status of the product)
2. It there stock to cover the order now, even if there was when the user chose to order it, if not reject the line item, unless the user has specifically said "okay to back order"
But I would use a trigger to make sure that the status of the line item matched the expectation of order.
|||Thnx Buddys!
I've written a view to show all the product with current stocks (PurchaseQty - IssueQty - DamageQty). And a sproc to wrap the view.
But I can't get an way to show a ledger for individual products, like -
Date Product PurchaseQty IssueQty DamageQty BalanceQty
Regards
Kapalic
|||Use a WHERE clause, passing in the ProductID -both in the stored procedure and the VIEW.
Very similar to the code we wrote for you last week.
Designing category system
Hi,
I am trying to design tables for managing category system.
In my inventory management system, I have a receive form, where I have to enter a product from a subcategory of a category.
I can't figuire out how should i design my tables. Am I correct with these tables -
Products Table - ProdID, ProdName, CatID, SCatID
Category Table - CatID, CatName
SubCategory Table - SCatID, SCatName
I can't show only the subCategories associated with a Category. What will be the design?
Also in the Receive form, which one will be logical? Should I select a category first, and related subCategories appears, and then product list form that subcategory appear?
Or should I select the product first, then categories and subCategories should appear?
Thanx a lot in advance for your help.
Regards
Kapalic
It depends how your hierarchy is,
suppose if your hierarchy follows ,
Category
|- Sub-Category
|- Product
Then you can go for following design,
Category -> CatId, CatName, ParentCatId
Where
CatId Primary key
ParentCatId foreign Key of CatId
(if ParentCatid is null then Category otherwise Sub Category)
Product -> ProductId, CatId
Where
CatId is Foregitn key of Category(CatId)
Regarding selection,
Product -> Sub-Category is ONE ON ONE relation
Sub-Cateogry -> Category is ONE ON ONE Relation
But,
Category -> Sub-Category is ONE To MANY relation
Sub-Cateogry -> Product is ONE ON MANY relation
Again its depends how your business rules defines.
|||
Hi ManiD,
Thnx for your reply! I will use the table structure u provided. This is much more logical.
And regarding to choosing fields, i do not have any binding other than existance of category and subcategory id. I just want an expert openion on which approach will be better for the users and developers perspective.
Regards
Kapalic
Designing a database within a database... design question storing data...
sure lots have you have done this before in some form or another).
At the end of the day, I'm storing the actual data generically in a
column of type nvarchar(4000), but I want to add support for unlimited
text. I want to do this in a smart fashion. Right now I am leaning
towards putting 2 nullable Value fields:
ValueLong ntext nullable
ValueShort nvarchar(4000) nullable
and dynamically storing the info in one or the other depending on the
size. ASP.NET does this exact very thing in it's Session State model;
look at the ASPStateTempSessions table. This table has both a
SessionItemShort of type varbinary (7000) and a SessionItemLong of type
Image.
My question is, is it better to user varbinary (7000) and Image? I'm
thinking maybe I should go down this path, simply because ASP.NET does,
but I don't really know why. Does anyone know what would be the benifit
of using varbinary and Image datatypes? If it's just to allow saving of
binary data, then I don't really need that right now (and I don't think
ASP.NET does either). Are there any other reasons?
thanks,
dave>I have a system that basically stores a database within a database (I'm
> sure lots have you have done this before in some form or another).
Please explain. What form is the data you are storing? If it isn't
represented relationally then why use SQL Server?
--
David Portas
SQL Server MVP
--|||Dave (chakachimp@.yahoo.com) writes:
> My question is, is it better to user varbinary (7000) and Image? I'm
> thinking maybe I should go down this path, simply because ASP.NET does,
> but I don't really know why. Does anyone know what would be the benifit
> of using varbinary and Image datatypes? If it's just to allow saving of
> binary data, then I don't really need that right now (and I don't think
> ASP.NET does either). Are there any other reasons?
Depends on the data you are storing. Since you talk about a "database with
a database", my initial reaction was you would use image, since I assumed
that the database is a binary file, complete with indexes, integer numbers,
and whatever.
But if the "database" is represented in text, for instance an XML document,
then there is no reason to use binary datatypes.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||I'm sorry, I need to elaborate. When I say database within a database,
I don't meen storing the actual database in a binary column or storing
XML in a column, instead I mean defining the structure of data within a
set of tables.
Instead of a concrete table such as Member with 3 columns: MemberID
int, FirstName varchar(25), LastName varchar(25), it is defined as an
abstract table that's defined across a series of tables. One row of any
of my abstract table actually lives (potentially) in several rows of a
sort of "Value" table. This "Value" table contains one column
(Varchar(4000)) that actually stores the value of the data item.
In our system we have over 15 abstract objects (Member being one of
them), so I know people will begin to question the architecture, but
that is not my point here... We do this for many reasons
1) We must store history on all changes (we write medical software)
2) We must encrypt the data and this allows a generic way to do this
(just flip a bit)
3) Our application will soon allow it's users to create user-defined
table and this is set up perfectly for that since it would only require
DML to achieve this (not DDL)
4) Speed isn't that important, right now our product has 10 users max.
Even if it became an issue we could solve this easily...
thanks,
dave|||Dave (chakachimp@.yahoo.com) writes:
> I'm sorry, I need to elaborate. When I say database within a database,
> I don't meen storing the actual database in a binary column or storing
> XML in a column, instead I mean defining the structure of data within a
> set of tables.
> Instead of a concrete table such as Member with 3 columns: MemberID
> int, FirstName varchar(25), LastName varchar(25), it is defined as an
> abstract table that's defined across a series of tables. One row of any
> of my abstract table actually lives (potentially) in several rows of a
> sort of "Value" table. This "Value" table contains one column
> (Varchar(4000)) that actually stores the value of the data item.
> In our system we have over 15 abstract objects (Member being one of
> them), so I know people will begin to question the architecture, but
> that is not my point here... We do this for many reasons
> 1) We must store history on all changes (we write medical software)
> 2) We must encrypt the data and this allows a generic way to do this
> (just flip a bit)
> 3) Our application will soon allow it's users to create user-defined
> table and this is set up perfectly for that since it would only require
> DML to achieve this (not DDL)
> 4) Speed isn't that important, right now our product has 10 users max.
> Even if it became an issue we could solve this easily...
Thanks for the elaboration, but I am not sure that this really provided
any more actual useful information to answer the question. "The database
within in a database", is thuse some sort of object that cannot be described
in a single table - nothing strange with that Order + OrderDetails is a
classic example.
But if I remove the veil about databases within database, and just take
the core question of yours: what datatype should use to save text data,
the answer is (n)varchar or (n)text, depening on your need to support
Unicode and the size limits of the data.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Let me completely rephrase my approach...
If you've ever installed the sql data model for ASP.NET that resides in
sql server, you'll notice that Microsoft has a table called
ASPStateTempSessions. There are two columns that hold the encrypted
session data of the user. These two columns are:
varbinary(7000)
Image
and they are each nullable. Depending on the size of the Session data,
one or the other column is used since Blob columns (such as Image,
Text, etc...) are inefficient. Using the Session in ASP.NET you'll
notice that it consists of strings only, so why did Microsoft decide to
use these types? Is there some effieciency thing? Or were they planning
on simply supporting possible binary data in the future.
-dave|||Dave (chakachimp@.yahoo.com) writes:
> If you've ever installed the sql data model for ASP.NET that resides in
> sql server, you'll notice that Microsoft has a table called
> ASPStateTempSessions. There are two columns that hold the encrypted
> session data of the user. These two columns are:
> varbinary(7000)
> Image
> and they are each nullable. Depending on the size of the Session data,
> one or the other column is used since Blob columns (such as Image,
> Text, etc...) are inefficient. Using the Session in ASP.NET you'll
> notice that it consists of strings only, so why did Microsoft decide to
> use these types? Is there some effieciency thing? Or were they planning
> on simply supporting possible binary data in the future.
Sorry, I have zero knowledge about ASP .Net, so I cannot answer any
question about its design.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Been Working on the AspState database, some information indicates that
the transfer of the string data is being done as a binary stream for
efficiency, thus requiring a binary db datatype to store it.
*** Sent via Developersdex http://www.developersdex.com ***
Friday, February 24, 2012
Design Question: Calculated Field
Services (AS). I want the AS cube to be based on a database with a
star schema.
I have a field called Ratio. The initial ratio value is based upon
this formula: (CurrentTimePeriodAmount -
PreviousTimePeriodAmount)/PreviousTimePeriodAmount. However, that
initial ratio can be manually overridden and replaced. Then the ratio
is used to calculate future Amounts.
Should I place that calculated Ratio field in the "source" database
design or should it be part of the Analysis Services cube?What you may want to consider instead of creating a new field in the
physical table, is to use a view with the calculation there. I am a
huge advocate of using views for fact tables for the reason you are
talking about below.
The problem is if the ratio is going to be replaced/overridden you
need to ask yourself do you need to create a new record for this
ration value so you can track the changes over time. Are these changes
going to be adhoc, if so does your front-end tool allow for this type
of What If Functionality. Things to ask yourself.
HTH
-todd
imani_technology_spam@.yahoo.com wrote in message news:<8be6e8.0402030738.213518f7@.posting.google.com>...
> I'm trying to create an OLAP system using SQL Server 2000 Analysis
> Services (AS). I want the AS cube to be based on a database with a
> star schema.
> I have a field called Ratio. The initial ratio value is based upon
> this formula: (CurrentTimePeriodAmount -
> PreviousTimePeriodAmount)/PreviousTimePeriodAmount. However, that
> initial ratio can be manually overridden and replaced. Then the ratio
> is used to calculate future Amounts.
> Should I place that calculated Ratio field in the "source" database
> design or should it be part of the Analysis Services cube?|||I want to be able to display an initial, calculated ratio. I also
want a seperate field for the user to type in a ratio. How could that
be implemented? Also, I'm considering using SQL Server Analysis
Services with some kind of MS Excel 2000 front end.
toddack@.hotmail.com (Todd) wrote in message news:<a4f4b945.0402031412.4c3173fd@.posting.google.com>...
> What you may want to consider instead of creating a new field in the
> physical table, is to use a view with the calculation there. I am a
> huge advocate of using views for fact tables for the reason you are
> talking about below.
> The problem is if the ratio is going to be replaced/overridden you
> need to ask yourself do you need to create a new record for this
> ration value so you can track the changes over time. Are these changes
> going to be adhoc, if so does your front-end tool allow for this type
> of What If Functionality. Things to ask yourself.
> HTH
> -todd
> imani_technology_spam@.yahoo.com wrote in message news:<8be6e8.0402030738.213518f7@.posting.google.com>...
> > I'm trying to create an OLAP system using SQL Server 2000 Analysis
> > Services (AS). I want the AS cube to be based on a database with a
> > star schema.
> > I have a field called Ratio. The initial ratio value is based upon
> > this formula: (CurrentTimePeriodAmount -
> > PreviousTimePeriodAmount)/PreviousTimePeriodAmount. However, that
> > initial ratio can be manually overridden and replaced. Then the ratio
> > is used to calculate future Amounts.
> > Should I place that calculated Ratio field in the "source" database
> > design or should it be part of the Analysis Services cube?