What Is Single Usermode?
Mar 13, 2007
Dear Experts,
while i'm practicing DBCC commands, it is saying the database should be in single user mode. how can i change my database with ALTER Database command?
and what are other modes of a database?
thank you very much
Vinod
View 2 Replies
ADVERTISEMENT
Apr 23, 2006
I am having problem restoring a data i backup in master database for an application upgrade. I have this error message that ' i can only restore in single usermode for master database that i should change to single user mode'
View 3 Replies
View Related
Apr 4, 2006
How can i combine my data in single row ? All data are in a single table sorted as employeeno, date
Code:
Employee No Date SALARY
1 10/30/2006 500
1 11/30/2006 1000
2 10/25/2006 800
3 10/26/2006 900
4 10/28/2006 1000
4 11/01/2006 8000
Should Appear
Code:
EmployeeNo Date1 OLDSALARY Date2 NEWSALARY
1 10/30/2006 500 11/30/2006 1000
2 10/25/2006 800
3 10/26/2006 900
4 10/28/2006 1000 11/01/2006 800
PLEASE HELP I REALLY NEED THE RIGHT QUERY FOR THIS OUTPUT.
THANKS IN ADVANCE
View 3 Replies
View Related
May 10, 2015
Here is some data that will explain what I want to do:
Input Data:
Part ColorCode
A100 123
A100 456
A100 789
B100 456
C100 123
C100 456
Output Data:
Part ColorCode
A100 123;456;789
B100 456
C100 123;456
View 4 Replies
View Related
Jul 5, 2006
I have set up a sqlDataSource that returns one value.
I would like to assign the value to a string.
How would I acomplish this,
thanks
View 5 Replies
View Related
Dec 3, 2006
Hello, I created a stored procedure which selects a value according to ContentId. I know that will be only one value returned or none. So if a record is found I want to return the string contained in ContentHtml. Else I want to return the string "NotFound" Could somebody help me out with this? Here is my present stored procedure: -- Specifies the SQL-92 equals compliant behavior SET ANSI_NULLS ON GO -- Specifies the SQL-92 quotation mark rules SET QUOTED_IDENTIFIER ON GO -- Alter procedure ALTER PROCEDURE [dbo].[by27_Content_GetContent] -- Define the procedure parameters @ContentName NVARCHAR(100), @ContentCulture NVARCHAR(5) AS -- Prevent extra result sets from interfering with SELECT statements. SET NOCOUNT ON; -- Declare and define ContentId DECLARE @ContentId UNIQUEIDENTIFIER; SELECT @ContentId = ContentId FROM dbo.by27_Content WHERE ContentName = @ContentName -- Check if ContentId is Not Null IF @ContentId IS NOT NULL BEGIN -- Select localized content from by27_ContentLocalized SELECT dbo.by27_ContentLocalized.ContentHtml FROM dbo.by27_Content INNER JOIN dbo.by27_ContentLocalized ON dbo.by27_Content.ContentId = dbo.by27_ContentLocalized.ContentId WHERE (dbo.by27_ContentLocalized.ContentCulture = @ContentCulture AND dbo.by27_Content.ContentName = @ContentName); END -- Create procedure GO Thanks, Miguel
View 1 Replies
View Related
Mar 5, 2007
Hi,
I have a SqlDataSource(named SQLDS1) which retrieves 4 value from database(ProductName,ProductCost,ProductID). I Have a DropDownList(DDL1) control and its DataSource SQLDS1.
DDL1 Selected data field to display is ProductNameDDL1 Selected data field to value is ProductCost
I did all this in Visual Part without any line of code. But in the code behind , When i select an item from DDL1 i need its ProductName,ProductCost and Also ProductID. It is simple to get first two. But how can i get the ProductID. Is there anyway to get ProductID from SQLDS1.
Happy Coding
View 1 Replies
View Related
May 26, 2007
Hi, is it possible to make an sql query that has an Outer Join but return only one row of results max per id.
For example i have an Articles table, and a PicturesForArticles table.
The Articles table has an id field(aid), a title field(aTitle) and a content field(aContent).
And the PicturesForArticles table has an id field(pid), a PicPath filed and a field linking it to the articles table(aid)
Obviously the PicturesForArticles field stores pictures for the articles, and article can have a multiple number of pictures, or no pictures at all.
So i want to make a query that will return all of the Articles fields and a picture for each article. Even if the article has many pictures i only want to get a single row for each aid(Articles Id), and if there are no pictures for that article the picture fields will be null.
Is there any way to do this, to only return on row of results for each aid?
Thanks
View 4 Replies
View Related
Jun 14, 2007
Hi,
I have received a text file in the following format:
MthYear Customer Quantity Price Total
Apr2003 Allan 100 5 500
--------- Austin 25 2 50
--------- George 1500 1 1500
---------- Jessy 200 2 400
Apr2004 Jerry 600 3 1800
--------- Stella 250 2 500
June2005 XXXX 50 5 250
I am exporting this text file in Sql Server database table. After exporting I need to Update the MtnYear field marked as ------- to appropriate year. ie
The MthYear field for Austin, George,Jessy should be updated with Apr2003,
The MthYear field for Stella should be updated with Apr2004
iiily, for other records. Let me inform if this is possible with the help of a single query or any better way of doing it. The records that i need to update is more than 2 lakhs. I am sorry if u feel this questionis not apropriate.
View 3 Replies
View Related
Nov 1, 2005
greetings,i was wondering is it better to have multiple small stored procedures or one large store procedure ???? example : 100 parameters that needs to be inserted or delete ..into/from a table.............is it better to break it up into multiple small store proc or have 1 large store proc....thanks...............
View 3 Replies
View Related
Oct 20, 2001
I'm doing a BCP of a large table 37 million rows. On a single CPU server, SQL 7, sp 3, with 512 meg of RAM, this job runs in about 3 hours. On a 8 way server with 4 Gig of RAM, SQL 7 Enterprise, this job runs 12 hours and is only a third done. The single CPU machine is running one RAID 5 set while the 8 way server is running 4 RAID 5 sets with the database spread out over two of them.
Is there something obvious that a single CPU box would run this much faster?
View 5 Replies
View Related
Nov 16, 2001
I have a query that returns a certain amount of results. How do I select the last row??? I know I can do the top row by doing (top 1). Basically I need the complete opposite. Please help...
I looked around and couldn't find anything on it.
thanks in advance
View 2 Replies
View Related
Sep 28, 1999
I've managed to BCP in a single table form a backup DAT file into a database, but it took WAY to long (1 hour+ on a meaty server) and I can't understand why.
The table only had a few rows of data and only had a few small dependancy tables.
The table has a primary key, hence an index so the BCP becomes a logged operation but it still should not take this long.
Here is the BCP command line that I ran :-
bcp <dbname>.dbo.<tablename> in <DAT filename> /U sa /P /S <server> /m 1 /n
Could anyone please shed some light on this. Is there anyway of 'fast' bcp'ing this table into the database overwriting the existing one.
Failing that, is there any way of scripting the transfer of a table from one server to another.
Many thanks.
Dave
View 2 Replies
View Related
Jan 7, 2007
Hello
I have a sql query that shows the top N numbers of records and also wanted to show the total numbers of this records.
Code:
.
.
.
rs_1.Open "SELECT top 5 msg_id, message, topic_id, last_post_by, id, sdate FROM forum_table",conn,1,3
rs_2.Open "SELECT msg_id, message, topic_id, last_post_by, id, sdate FROM forum_table",conn,1,3 “
Top number to show: <%=rs_1.recordcount%>
Total number of records in database: <%=rs_2.recordcount%>
.
.
.
As you can see, it is only on the same database that I am querying. How do I make a single sql query out of this?
View 3 Replies
View Related
Jul 6, 2004
i hav a table of the form
table EMP
(
EMPNAME varchar(50)
)
and the data in the table is
record #1 abc
record #2 abc
record #3 abc
record #4 abc
record #5 abc
record #6 abc
can i use a single query so as to retain a single record in the table and remove the rest ?
View 14 Replies
View Related
Feb 23, 2005
How can I do it by using two subqueries the second of them to be aggregate and have two left joins from the first to the second??
e.g. How can I left join these two queries with the joinfield1,joinfield2 fields??
1st query
Select field1, field2, joinfield1,joinfield2 FROM Table1 INNER JOIN Table2 ON Table1.field3 = Table2.field4 where field5=Value
2nd query
Select sum(agfield1) As f1, sum(agfield2) As f2, joinfield1,joinfield2 FROM Table3 INNER JOIN Table4 ON Table3.agfield3 = Table2.agfield4
where agfield5=Value
Group By joinfield1,joinfield2
View 3 Replies
View Related
May 31, 2006
Does anyone know how should I write the sql for getting the following result?
Original Table like below.
-------------------------------
[WorkDay][AgentCode]
06/12/01 3
06/12/02 2
06/12/02 3
06/12/03 2
06/12/03 3
-------------------------------
Curernt SQL:
When I put an "agentcode=2" in 'WHERE' clause, the result does not have '06/12/01' row.
Example,
SELECT DISTINCT WorkDay, AgentCode FROM MasterScheduleTransaction WHERE AgentCode=2
-------------------------------
[WorkDay][AgentCode]
06/12/02 2
06/12/03 2
-------------------------------
I would like to know the agent is in the specified date.
The expected result like below.
-------------------------------
[WorkDay][AgentCode]
06/12/01 NULL
06/12/02 2
06/12/03 2
-------------------------------
Please help its urgent
View 9 Replies
View Related
Apr 23, 2014
I ran a large query and exported it to xls. In Excel, I noticed a value of '2.00E+01'. I formatted the Excel cell and then got a value of '20'. I searched for the record in SQL Server 2008, ya I know, ancient. The value is '2E1' which excel is seeing as scientific notation.
Can I use a case statement that when an 'E' is present to add a single prefix quote like '2E1? Or perhaps do it for the whole column? Or put put double quotes around the whole field?
View 2 Replies
View Related
May 6, 2015
I'm trying to get all this data into a single row, but instead I'm getting results like a staircase with multiple rows. What concept am I missing here?
View 5 Replies
View Related
Jul 4, 2006
How to remove the label "Single User" in the database?
View 2 Replies
View Related
Apr 24, 2007
Hi
i hav a query as
select skill_id from o_skills where employee_id=78
Output of the above query is:
skill_id
-----------
5
13
3
But i want output as
skill_id
--------
5,13,3
how can i get the above result
Thanks in Advance
Malathi Rao
View 4 Replies
View Related
Mar 13, 2008
iam having two statement for updating one table.
just i need to club into one statment.can any one tell how this can be achieved.
first statement:
===================
--Updating Customer code
update stg
set stg.customer_code=dtl.cgd_customer_code
from Subsidiary_Ageing_tb stg(nolock) inner join fin_ods..cust_group_dtl dtl(nolock)
on dtl.cgd_cust_group_code=stg.customer_grp
second statment:
===================
--updating customer name
update stg
set stg.customer_name=dtl.clo_cust_name
from Subsidiary_Ageing_tb stg(nolock) inner join fin_ods..cust_lo_info dtl(nolock)
on dtl.clo_cust_code=stg.customer_code
View 1 Replies
View Related
Jun 24, 2006
Pros-------* Can optimize the hell out of the database because it does not have toaccomodate different OSes* Code is probably cleaner - not littered with 80 million #ifdefs* No need to write the code to deal with various filesystem conventionsCons--------* Most cheap webhosts are unix-based (I think). You can use Oracle as aprofessional and still do your personal home hacking on oracleregardless of whether personal hosting is done on windows or unix. Notso with MS SQL.
View 10 Replies
View Related
Nov 9, 2006
How do I insert a single quote ' into a table? For example:Insert mytable values (1,''')I get an error message.Any ideas? The server does not recognize double quote (why? is thistsql, ansi?), otherwise I could have written it as:Insert mytable values (1,"'")Thanks.
View 4 Replies
View Related
Jul 20, 2005
Can we make a Index on 2 or more tablesTable a:Col1 intcol2 varcharTable b:Col1 intcol2 varcharcan you have a single index for two tables a and b on the column Col1.Is this possible in SQL-Server.As far as i know you can make an index only on one Table.can the index be shared by two tables?index y which is created is shared bytable a , table b and table cI like the idea of a union an putting it in a veiw and having a indexbut i dont want to make 100 views for a special index.first of all i want to know wether the index is only on one table can beon multiple tables.*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 3 Replies
View Related
Feb 29, 2008
I've got a package that needs to do various single-row inserts/updates throughout the flow of the package. Each insert/update will use values from variables.
What is the best practice for doing this? I was going to use a DFT with my source being a derived column transformation, but it expects a true data source.
I've also thought about just using the obvious -- a SQL command task -- by my experience with doing commands using single values is that it's very quirky and hard to get the data types and mappings to cooperate.
I'm betting the SQL command task is my only option, but I wanted to check here first to see if others had other ideas.
Thanks in advance.
Jerad
View 5 Replies
View Related
Oct 19, 2007
I have the following table
Name Score Date
A 10 10/19
A 20 10/18
A 30 10/17
B 40 10/18
B 50 10/15
B 60 10/14
I need to get
Name Score Date
A 10 10/19
B 40 10/18
Basically I need one row per Name and that row has to be for the most recent date for
that Name
In Sql 2005 you could do this by
with MyCTE Name,Score,Date,Rownumber as
select Name,Score,Date,Row_Number() (over partition by Name order by Date desc) as Rownnumber
from Table A
Select * from MyCTE where Rownumber=1
Does anyone know how this can be achieved on sql 2000 as Row_number function is not in sql 2000
Thanks for any help in advance
View 3 Replies
View Related
Mar 11, 2008
how can we make a stored proc single threaded so only one process can access it at a time to prevent deadock. or how to lock the tables eficiently???
View 1 Replies
View Related
Nov 13, 2007
Hi all
I want single cots with my string
3
i want '3' like this plz help me
View 4 Replies
View Related
Mar 13, 2008
I have the following table:
id geounit parentgeounit
Here's some sample data:
1 Northeast null
2 Southeast null
3 New Jersey 1
4 Florida 2
Basically I need to return the parentgeounit's name, for instance for record #4 I'd want to return
4 Florida Southeast
Instead of:
4 Florida 2
Can this be accomplished?
View 3 Replies
View Related
Jun 29, 2006
I am using SQL Server 2005, I have a NVarChar parameter called @Text that I use to build a dynamic Where clause for my SELECT Statement.
SET @l_Where = @l_Where + N' AND (StatusDesc LIKE ''' + Replace(@Text, "'", "''") + N'%'')'
This gives me an invalid column error.
How do I replace the single quotes in @Text with 2 Single Quotes?
TIA,Jason
View 1 Replies
View Related
Oct 29, 2006
So I have code to fill my repeater with a data: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim cnn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("db_ConnStr").ConnectionString) Dim cmd1 As Data.SqlClient.SqlDataAdapter = New Data.SqlClient.SqlDataAdapter("SELECT aspnet_Users.UserName, COUNT(forum_posts.post_id) AS IlePost, forum_posts_1.post_content, forum_posts_1.topic_id, forum_posts_1.post_id, forum_posts_1.post_date FROM aspnet_Users INNER JOIN forum_posts ON aspnet_Users.uID = forum_posts.user_id INNER JOIN forum_posts AS forum_posts_1 ON aspnet_Users.uID = forum_posts_1.user_id GROUP BY aspnet_Users.UserName, forum_posts_1.post_content, forum_posts_1.topic_id, forum_posts_1.post_id, forum_posts_1.post_date HAVING (forum_posts_1.topic_id = @topic_id) ORDER BY forum_posts_1.post_date ASC", cnn) cmd1.SelectCommand.Parameters.AddWithValue("@topic_id", Request.QueryString("ID")) Dim ds As Data.DataSet = New Data.DataSet cnn.Open() cmd1.Fill(ds, "posts") Repeater1.DataSource = ds.Tables("posts") Page.DataBind() cnn.Close() End Sub And I want to take the value from column which I bolded - IlePost. I want take this out at compare with some condition. For example:Dim label as label = Repeater1.Findcontrol("Label1")If COLUMN < 10 thenlabel.text = "Less than 10"elselabel.text = "More than 10"I hope you understand me :-)
View 1 Replies
View Related
Jan 30, 2007
Hi,
How can I convert this results :
col 1
col 2
col 3
col 4
col 5
col 6
col 7
val 1
val 2
val 3
val 4
val 5
val 6
val 7
into this
Col 1
val 1
Col 2
val 2
Col 3
val 3
Col 4
val 4
Col 5
val 5
Col 6
val 6
Col 7
val 7
View 6 Replies
View Related