.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Database CurrentUser Question

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
I am trying to check whether the user connected to a database is db_ownder so I am using the IsDbOwner property on the database object that was created from the Server object but it is setting the UserName to guest as opposed to the user connecting - any ideas? Thanks Scott

View Complete Post

More Related Resource Links

database interface design question


For handy database interface, is it good to use SqldataSources exclusively intead of EntLib functions?

Thanks for any feedback.

Detach/Attach database question

I recently restored a database from SQL7 to SQL2005.  When restoring the database I needed to create a c:\data\data folder or else it would not restore the mdf and ldf files. I would like to move these files to a new location.  Copied the the two files to a new folder, C:\database.  Using the sql studio manager, preformed a task to detach the database, then attach the database with the new location. This seemed to work, I am able to access my application that uses this database.  However, any changes I make to the program, are not writing changes back to the mdf file.  When I open the program, these changes are still in place, but the mdf file should be updated, correct?  When the database files were stored in the c:\data\data folder, any little change I made to the program changed the modified time for the mdf file. Is there something missing or where could these changes be written to?

Sharepoint Database size question

We have just installed Sharepoint 2010 in our network.  We currently have 2 users who are accessing the system, since we are in alpha stage.  What I have noticed is that  User Profile Service Application_SyncDB database size is at 800mb.  is this normal? In addtion, WSS_Logging database size is at 140mb. 

Question on Distribution Database ** HELP ! **

Hi, I am new to SQL2K8 replication.  I have been reading lots of articles/tutorials on this subject.  I was able to setup a Transactional Replication.  Everything is working as expected.   However, I wanted to further investigate as to what events are taking place behind the scene just to educate myself a bit more.  I found that in the process of creating my transactional replication, it created the "Distribution" database under the "System Database" node on my SQL 2008 box.  There is only one table called "UIProperties" with a column called ID.  My question is where is the Log Reader keeping the changes in my publications.  I can see when I made a change to a row in my publication, it got replicated to the subscription database.  But where is SQL Server storing these changes??  I guess when the distribution agents runs, where does it get the changes from?  From my reading, the Distribution database is supposed to keep tracking of these changes.  But I am finding any changes I made to my publication.  Can someone educate me on this? Thank you.  

about date in database question

hi i need to find data between 2 date's and time's. i use one field for date ,  and one field for time. **is it be better to use only one field for date & time ?** i see that it came in  `dd/mm/yyyy hh:mm:ss`  format that  can contain date and time. this question is for acceess and for sql-server thank's in advance

Newbie question about adventureworks database


Hi Guys,

I downloaded the Adventurworks2008 database and the AdventureworksDW2008 database for practice with SSIS.  I was wondering what the difference between the two databases is, because in the exercises im following it is stating that i will need to extract data from  the Adventureworks2008 database to the AdventureworksDW2008 database.

Is the the AdventureworksDW2008 an empty database and we are just extracting OLTP data to it? Please any help in clarifying this will be highly appreciated. Thanks!

database diagram question

in sql server 2010, is it possible to create a database diagram where there are two tables connected showing a many-to-many relationship without a bridge table?

Worker & Location Database design question


Hello to forums :)


I have a simple question on design.

A company has several 'Worklocations'. Each location employs several workers. Every worker can be associated with multiple locations.

So, I have decided to create below tables. please letme know if there is a better way to design it

worker table
wid (primary)

location table
lid (primary)

workerlocations (WID+LID => primary key)

Is this sounds right for you guys? let me know

Question about SQL Server Database sizes


I have SQL Server 2008, when I go into Server Management Studio and I right click on my database and choose properities.  I see two things, I see Size of 200.13 MB and Space Available of .44MB.  Does this mean my database can only grow by .44MB more of data?  If so, is there a way to change the max size?  When I was looking at documents on SQL Server Express 2008, I saw a 10GB limit on each Database instance, so I was assuming SQL Server 2008 would provide me more than 200.5 MB? 

I'd really appreciate any info/clearing up for me.



Can anyone answer of my Question regarding SQL server database connectivity??

I want to connect my sql server database using my desktop application. Now Just tell me can i connect directly to my database using IP Adress in my connection string????? my database

Exist is in other country


Please clear this confusion.


Thank in advance


database id question




Running this on an SQL 2005 server


This tsql statement returns 6

select DB_ID('erm') 

Also, this tsql statement returns 6

select database_id from sys.databases where name = 'erm'

But this one returns 5 rows all with a&n

Database Design Question


Hi everyone,

This is my scenario: I have 4 tables in my database at the moment. One of the tables contains all my users, each of which have a unique id(integer). One table contains the names and descriptions of certain lists of users so for example a row would be

table name: Lists


12    |     Example List     |    short description of the list


A third table contains the ID's of users that are in a given list:

table name: ListUsers


 12        |         213

 12        |         192

 12        |         84


My final table is filled with certain "events" I am holding that users on a list are invited to. (there are more fields in this table but they are not important).

table name: Events


Create DataBase Table Question


I am creating a table in a database in SQL Express and found the following example:


I''m confused at the Key word Constraint followed by PKeyMyID.  A table get created with myId and myName columns.  What is the CONSTRAINT PKeyMyID for?

Dennis in Longview

sql security question regarding sample 'pubs' database


if i have a sql login that belongs to the server role 'public' .


it does not have user access in  any database . however it can access pubs sample database why?

Question about unallocated space and unused space in a database


Hi, every expert,

I am running SQL server 2008 SP1, I've got a question about unallocated space and unused space in a database.

In my DB I run sp_spaceused as follows:

exec sp_spaceused 'DB_00001'

database_name database_size unallocated space


DB_00001 2004.13 MB 49.64 MB

reserved data index_size unused

------------------ ------------------ ------------------ --------------

1531248 KB 412720 KB 165168 KB 953360 KB

Question 1: As I understand, the unallocated space is never used by the database, while the unused space is once used by database but got freed by deleting etc (I mean deleting only removes part of the pages in section, for removing all the pages in section, see my 2nd question) ..am I correct?

Question 2:  if the deleting operation frees up the whole section, will the free section show as unallocated space? If the answer is no, how does SQL server handle this free section?

Question 3: If we shrink the datafile using the TRUNCATEONLY option, according to my understanding, the unallocated space can certainly be freed up as the following statement in Book Online, am I correct?

TRUNCATEONLY Releases all free space at the end of the file to the operating system but does not perform any page mov

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend