Quantcast
Channel: Forum Getting started with SQL Server
Viewing all 8979 articles
Browse latest View live

T-Logs on principal database in mirroring

$
0
0

Hi experts.

we have principal database participating in mirroring with HA CLUSTER, and we have job for taking Log backup for this principal database.

But,This principal database does fail over from time to time.  What happens if these transaction log backup jobs are setup and that copy is not the principal? 

In simple , if this principal database fails over, will the jobs which are created on PRINCIPAL database will be moved to the failover database.

Thanks.



Calling all SQL Server fans! Your chance to win love and glory! Be our November TechNet Guru!

$
0
0

November has been designated National Novel Writing Month and National Blog Posting Month.

But we don't want that! We want a professional wiki article!

TechNet Wiki provides anyone the chance to contribute Microsoft technology related content to the community!

And we'll love it, and tweak it, and show the world!

Everyone has an equal chance of becoming our TechNet technology Guru, every month.

Separate teams of judges (6-8 per category) read every article submitted.

Some of the most influential members of Microsoft in your favourite technologies contribute their judging time to this competition.

TechNet Guru awards also help to promote your progress within the community... and its inner circles.

These competitions also help towards real awards, even MVP recognition!

 

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over toTechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

Have you got what it takes o become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!

New to MSSQL - need help with a query to remove spaces within a field

$
0
0

After data conversion the leading and trailing spaces were removed from the data in the "tag" column.  However spaces in the middle of the column were not removed.  Tag data must be unique.  When I run an update script I get the message that "Cannot insert duplicate key in object 'mytablename'.   This tells me that my data looks like this:

AAAAA[space][space]BBBBB --unique tag

AAAAA[space]BBBBB -- unique tag

If I remove the spaces from each I will have duplicates.  Therefore I'd like to update the records as follows:

AAAAABBBBB --unique tag

DUP-AAAAABBBBB -- unique tag

How can I write a script that not only removes the spaces but also identifies the duplicate record?

manage historical data that will be used in grouping by webforms/reports?

$
0
0

Our system receives transactions in a per-minute basis, and each transaction is stored in aRaw Data table that's exclusively for this. All reports, gridview webforms, etc come from tables that are derived from this master table.

In this case I can't group the data during run-time due to the volume of data. So for tasks like the daily summary, should I just have a job that runs once daily and groups all the data from the current day and inserts it into a historical daily table? The same thing with the weekly?

I considered using BIDS and creating a cube, but due to the presentation of the data, it was beginning to look more complex. In other words, in order to show the desired result in a grid (plus include filters), I would need to use tons of MDX, which I still don't master.

Thanks.


VM

sql server access

$
0
0
after downloading sql server several times I can't see the basic database engine loaded

sqlquery to get all cases in a child table

$
0
0

I have to tables - demographics and PatSubs.  Both tables are linked by caseno filed.

Now, PatSubs may have one or many substance entry for the caseno.

If I do the following:

USE [njpies2013]

GO

SELECT [CaseNumber]

     ,[CenterCode]

     ,[YearCode]

      ,[SubVerbatim]

     

 FROM [dbo].[ToxExpSub]

   where SubPoisindexCode = 6931087

GO

I will only get the cases in PatSub that match =693107; however what I want is if there's a record with PoisendexCode 6931087 than give me all the entries in PatSub for THAT caseno

Please help me with this query,

Thanks

Raul


Raul Rego

With nolock is recomended

$
0
0

Hello

With(nolock) si recomendated with a database OLTP.


Entity Framework and Package Manager Publishing to Azure

$
0
0

I am creating a secure ASP.NET MVC 5 app and need to update the database in the Package Manager Console. There is an error that occurs every time I try to update the database. Following the instructions on this page http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/

I get the following error:

PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: unable to create the SQL Server process.
)

I have ensured that the Azure SQL has the firewall rule to allow my IP address access. Any advice would be appreciated. 


Unable to connect to SQL Server using DAC(Dedicated Administrator connection) through SQLCMD (-A)..

$
0
0

Hi All,

I am Unable to connect to SQL Server using DAC(Dedicated Administrator connection) through SQLCMD with the '-A' parameter,however I am able to get the connection through SSMS.

I am using the following string to get the connection 

SQLCMD -S IP,port -E -A

error: 

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : SQL Server Network Inte
rfaces: Connection string is not valid [87]. .
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : A network-related or in
stance-specific error has occurred while establishing a connection to SQL Server
. Server is not found or not accessible. Check if instance name is correct and i
f SQL Server is configured to allow remote connections. For more information see
 SQL Server Books Online..


aa

Export data using stored procedure to excel

$
0
0

How to export and save data from SQL Server to MS Excel using stored procedure.

Thanks in advance


Abhinav

Querying distinct

$
0
0

I am trying to execute a simple distinct query (i.e. select distinct name from tags), but the query is still returning duplicate names. 

Is there something else, am I suppose to add to the distinct query to make, the query return unique names from the 'tags' table. 

Please advice further.  Many thanks

Converting non atomic values into atomic

$
0
0

Hi everyone,

Assume that we have a table in the below shown way.

col1col2

1db2,sqlserver,oracle

2sybase,sqlite,teradata

3informix,postgrel,derby

col2 in the above table has non atomic values ryt.

Is there any way to cut the values into pieces while retrieving. 

eg:  db2sqlserveroracle

       sybasesqliteteradata 


Thanks and Regards, Readers please vote for my posts if the questions i asked are helpful.

Incorrect syntax near the keyword 'Values'

$
0
0

Hi all I was wondering if you could help I keep getting this error when I try to build this stored procedure in sql 2008

CREATE PROCEDURE dbo.TutorialAddHeadline
	@title varchar(100), @content varchar(MAX), @publisher varchar(50), @linkurl varchar(255)
AS
	BEGIN
	DECLARE @hash binary(16);
	SET @hash = dbo.TutorialHash(@title, @content);

VALUES(@publisher, @title, @content, @linkurl, @hash);
END

thanks

WMI query problem

$
0
0

I'm trying to run the following wmi query:

select ProcessId,Name,PageFileUsage from Win32_Process where ((Name = 'sqlservr.exe' AND CommandLine LIKE '%-sMSSQLSERVER%'))

I can do this with a local admin account, but not with the non-admin account I created.  If I remover the 'CommandLine Like' part of the query it runs fine.  This account is set up to run WMI queries and pulls everything else I need so far except this query which lets me see into my SQL Server instances.

Any ideas or suggestions are appreciated. 

Table Designer & computed colums & case statement

$
0
0
 

i am creating a table using table designer and i want to add a computed column for Age as follows:

CASE WHEN BirtheDate IS NULL THEN NULL
  WHEN DATEDIFF(yy,BirthDate, CURRENT_TIMESTAMP) >50 THEN 'OLDER'
  WHEN DATEDIFF (yy, BirthDate, Current_Timestamp)>40 then 'middle age' 
  else 'younger'

END

however, whenever i type this code i get an error. is there something that i should change to get it work?

is it possible to use case in table designer for a computed field?

Any answers i would be grateful.

thanks


sukai


Memory utilization was very high

$
0
0
Hi All

Memory utilization was very high 
RAM Was 18GB.
SQL SERVER.exe was utiling around 16GB 

Kindly suggest me how can we bring down memory utilization.
(we are not utilizing mirroring and Logshipping)

Regards
subu

subu

New install of older version on new machine questions (2008 R2 Express)

$
0
0

Hi,

I want to setup SQL Server 2008 R2 Express to an i5 machine running window 8.1. This should include ssis, ssrs, ssas, and the management studio. The instructions say to:

Step 1: Install Microsoft .NET Framework 2.0 or later from theDownload center

Step 2: Download SQL Server Express by clicking the SQLEXPR.EXE or SQLEXPR32.EXE link on this page. To start the installation immediately, click Run. To install SQL Server Express at a later time, click Save.
Note: SQLEXPR32.EXE is a smaller package that can be used to install SQL Server Express on 32-bit operating systems only. The SQLEXPR.EXE package supports installing onto both 32-bit and 64-bit (WOW install) operating systems. There is no other difference between these packages.

Step 3: Follow the installation instructions provided in the Readme. Known issues may be found in the release notes.

How do I do this on a new operating system without messing up the operation of other programs?

Is there any downside to loading the 64 bit version?

There are 9 files in the download section, none exactly the same name?

Does this also require installation of Visual Studio? If so which ver.?

I could not find a way in 8.1 to see the version of .net framework but is it likely higher than the required 2.0?

Sorry for my lack of understanding these basics, I have been siloed doing VBA for Access and Excel. The last I wrote any T-SQL was ver. 2000 about 8 years ago and need to expand my skills for a new assignment.

Thanks for any assistance,

alr0

varchar(max) vs varchar(255)

$
0
0

 

Hi guys,

 

I'm new to MS-SQL 2005, I will ask you a bunch of questions and I hope I will not be too boring hehe !

 

I learned that in MS-SQL 2005, you can now use varchar(max), my question is why not always use varchar(max) since it will automatically use only the space needed ? Is there an advantage in specifying a size other than max when you use a varchar for an entry that can vary in length alot ?

 

Thank you very much,

 

Konnan

AUto-renaming mdf & ldf filenames when restoring a database with SQL Management Studio

$
0
0

Hi!

I am using SQL Management Studio 2014 and I am experiencing some problems when restoring a database backup.

I have a SQL Server 2008R2 & SQL Server 2012 instances.

On the 2012 instance, when I restore a database and rename it into a new name, the mdf and ldf files get automatically renamed into the new database name : Great, this is the behavior that I expect.

On the 2008R2 instance, the mdf and ldf files don't automatically get renamed to match the new database name and I have to perform the renaming manually - pretty annoying.

Has anybody experienced this problem ? If yes, do you know of a fix ?

Thank you

Frederic

BCP Utility Comma

$
0
0
I have the following problem. I need to create a .csv file with SQL (with the bcp utility). I can create this .csv file and the following data is inserted:
1","ad","dsa","333","","2","0","","","","""

I want to avoid this double quotes. I want only double quotes if there is a comma in one field. For better understanding, the following 3 cases must be done.

Fields containin commas can be surounded by quotation marks, these must be double quotation marks (“ ”) and not single (‘ ’) e.g.

“a, b, c” would be accepted as 1 single field but a, b, c would be 3 separate fields.

In adition, any double quotation marks which need to be displayed in a field must also be surounded by double quotation marks e.g.

If an address should display as “The Street”, this should be sent as ““The Street””

Apostrophes can be sent in the file e.g.
A client with surname O’Clay and forename Jenny with a free text field holding “comma, example” would be sent in the file as O’Clay,Jenny,”comma,example”.


This is my code:
bcp TESTPROJECT.dbo.table out c:\aa.txt -c -t"\",\"" -r"\"\n\"" -S .\sql2014 -U username -P password

So the problem is in the -t"\",\"" -r"\"\n\"" part but how I can do this?
Viewing all 8979 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>