Tuesday, July 30, 2013

[SQL 2012] New Guy

[SQL 2012] New Guy


New Guy

Posted: 29 Jul 2013 01:31 PM PDT

Hi everyone,I am new to the forums and to SQL, so I am saying hello! I'm looking to develop my abilities with SQL due to personal interest and due to my interest in pursuing a new career path. I've gone through some guides and examples on SQLzoo.net and a few other sites. My next step will be reading some books (70-461, Querying Microsoft SQL Server 2012 by Itzik Ben-Gan and Microsoft SQL Server 2012 T-SQL Fundamentals by Itzik Ben-Gan), installing SQL Server 2012 (trial), working through some examples, and most importantly meeting you guys, the experts. Any advice is appreciated. Cheers!-Bob

LINKED SERVER

Posted: 30 Jul 2013 01:44 AM PDT

Hi,I have a 64-bit Windows 7 ultimate server with SQL srv 2008 R2 (64 bit). I am trying to pull data from a Sybase database by using Linked Server in SQL srv. so, I have created ODBC DSN for SYbase connection. DSN works perfectly when connecting from ODBC DATASOURCES(64BIT)..Im trying to create LinkedServer in Sql using wizard, but I am getting following error msg,"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"...I tried with 32 bit ODBC dsn also, but no use.Can anyone experienced and solved this?

The defination of object has changed since it was complied

Posted: 29 Jul 2013 06:39 PM PDT

Hi all, I am facing a weird problem since couple of days, When we tried to execute the any SP (Randomly) sometimes throws the error "The definition of object has changed since it was compiled" and if I recompile it or alter the procedure it works fine.My Doubts : 1. First of all why this error occurs and how can I tackle this.2. Is there any auto process I can set, so this problem never occurs.3. I read somewhere in the forum that sp_recompile running of whole database will solve it, but running it every time is right approach ? as this will clear the execution plan of that object.Thanks,Bhaskar Shetty

SQL server cluster Failover installation

Posted: 30 Jul 2013 01:16 AM PDT

Hi guys i am supposed to do a failover installation on Windows server.I have to create a cluster group, Do any one know any site or video or notes which guides me to get prepared.Rookie here :hehe:

Can many or a group of Transaction Logs be automatically restored?

Posted: 29 Jul 2013 06:42 AM PDT

We are running SQL Server 2012 SP1 64-Bit EE on Windows Server 2008 R2 SP1. We are taking a full backup on Sunday night, a diff backup Monday through Saturday night, and trans log backups Monday through Friday every 10 minutes from 7 A.M. to 6 P.M. If we have to recover the database at 5 P.M. (for Monday through Friday), then we would have to manually run a restore of the tlogs for every 10 minutes up until 5 P.M. That would be about 60 restore commands to restore all tlog backups between 7 A.M. and 5 P.M.With SQL Server, is there a way to automatically restore multiple or a group of tlog backups? (Oracle automatically recovers a large number of archive logs with RECOVER DATABASE USING BACKUP CONTROL FILE UNTIL CANCEL;).Thanks in advance, Kevin

Table Partition

Posted: 29 Jul 2013 09:45 PM PDT

Hi All,I have partitioned VOICE_CALL table, size=130 GB(spill-ted into 10 ndf files) But before partition mdf files size 350 GB,After partition mdf file size 351 GB. 10 Ndf files size 99 GB so total database size is 449 GB [b]Why mdf file size not decreased ? even-though I was moved data to ndf files ?[/b]Thanks,Ramana

RSAT Installation Issue.

Posted: 29 Jul 2013 11:10 PM PDT

Hello,I am trying to install remote server administration tools to then install Hyper-V, to then install Windows and then finally some SQL 2012 instances.The issue though is right at the start with RSAT, it just wont load on Windows 7 with SP1, this appears to have been an issue for ages, I have tried so many ways to get it done, including all the CMD options. Has anyone here got any experience of this? I cant uninstall SP1 to load RSAT because SP1 is built into my build. I'm sure this may be off topic to some, but I figure there must be some other DBA's that have encountered this issue. Any help is greatly appreciated, I'm going nuts!Thanks,D.

Using non-deterministic T-SQL functions inside a UDF

Posted: 29 Jul 2013 02:47 PM PDT

Is it even possible to use a non-deterministic function like RAND() inside a UDF? If so, how?I'm trying to write a function to generate semi-random numbers, and it lands flat on its face...[code="sql"]CREATE FUNCTION dbo.GetRandomNumber (@Lower int, @Upper int)RETURNS intWITH SCHEMABINDING ASBEGIN DECLARE @Random int SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0) RETURN(@Random)END[/code]I get this:Msg 443, Level 16, State 1, Procedure GetRandomNumber, Line 7Invalid use of a side-effecting operator 'rand' within a function.If I'm reading it right (no guarantees, mind you!), I can't do this. If I'm inside a stored procedure, I can generate the numbers just fine... so I guess I could do that if I needed to.So is there any way to get SQL Server to return a value for a non-deterministic T-SQL function to a Function I created?Thanks

Inserted xml data in to Sql server records

Posted: 29 Jul 2013 05:36 PM PDT

Please anyone can help me to insert xml file data in to SQL ServerEx : <ROOT><Customers><Customer CustomerID="C001" CustomerName="Arshad Ali"><Orders><Order OrderID="10248" OrderDate="2012-07-04T00:00:00"><OrderDetail ProductID="10" Quantity="5" /><OrderDetail ProductID="11" Quantity="12" /><OrderDetail ProductID="42" Quantity="10" /></Order></Orders><Address> Address line 1, 2, 3</Address></Customer><Customer CustomerID="C002" CustomerName="Paul Henriot"><Orders><Order OrderID="10245" OrderDate="2011-07-04T00:00:00"><OrderDetail ProductID="11" Quantity="12" /><OrderDetail ProductID="42" Quantity="10" /></Order></Orders><Address> Address line 5, 6, 7</Address></Customer><Customer CustomerID="C003" CustomerName="Carlos Gonzlez"><Orders><Order OrderID="10283" OrderDate="2012-08-16T00:00:00"><OrderDetail ProductID="72" Quantity="3" /></Order></Orders><Address> Address line 1, 4, 5</Address></Customer></Customers></ROOT>Please tell me how can we insert data in to sql recordsRaghu KotamSr.SQL Developer

newbie

Posted: 29 Jul 2013 07:41 AM PDT

Hi guys I am a newbie. Will you guys be my friend?

The view contains a convert that is imprecise or non-deterministic error when trying to create a clustered index on a view

Posted: 29 Jul 2013 07:17 AM PDT

So I am attempting to create a clustered index on a view. I am trying to create the index off of the following fields (order_date (datetime), offer_code varchar(3), and demandtype varchar(1)).When I try and created the clustered index I receive the following error: Cannot create index or statistics 'IX_vw_sale_demand' on view 'vw_sale_demand' because key column 'INDATE' is imprecise, computed and not persisted. Consider removing reference to column in view index or statistics key or changing column to be precise. If column is computed in base table consider marking it PERSISTED there.Now the order_date is stored as a decimal(10,0) in the base table and I am converting it to a datetime in my view. From what I have read - the error happens mostly when using float values. Any ideas on how to fix this? Thanks for the help in advance - will continue to search for an answer and will post if I find one......

NETWORK SERVICE cant read system view

Posted: 16 Jul 2013 07:08 AM PDT

I'm trying to run the following query from a Web Service: SELECT last_user_update FROM sys.dm_db_index_usage_statsI get an error when I try this, saying that the current user does not have permissions. Here's what I know;- The web service runs as NT AUTHORITY\NETWORK SERVICE- NT AUTHORITY\NETWORK SERVICE has the "public" role on the database- The view sys.dm_db_index_usage_stats has two SELECT permission options, one with a blank grantor and one with "dbo" as a grantor. "public" is given access to the one with dbo as the grantor - I tried to check the other select box, but SQL quietly unchecks it when I close the window, so I'm basically not able to change the permissions on this view.Is there a way that I can grant access to sys.dm_db_index_usage_stats for NT AUTHORITY\NETWORK SERVICE?or... Is there another way I can discover the last access time on a table that does not require access to sys.dm_db_index_usage_stats?

Configuring Database Mail with an SQL Server Agent Operator with multiple email addreses.

Posted: 29 Jul 2013 07:26 AM PDT

We are running SQL Server 2012 SP1 64-Bit EE on Windows Server 2008 R2 SP1. (To create an Operator Group, go to SQL Server Agent, Operators, DBA Group Properties and specify 'DBA Group' beside the 'Name:' Box and the email addresses in the 'E-mail Name:' Box.) Use the code below to associate the Operator with email addresse. The first piece of code updates the Operator with an Exchange Distribution Email Address (sqldba@school.net). The Exchange Distribution Email Address points to 3 email addresses. This works fine. USE [msdb]GOEXEC msdb.dbo.sp_update_operator @name=N'DBAGroup1', @enabled=1, @pager_days=0, @email_address=N'sqldba@school.net', @pager_address=N'', @netsend_address=N''GOThe second piece of code updates the Operator with 3 individual email addresses. With the Operator set up this way, it does not work; the email is not sent. The Error Message is listed below (I have tried the email addresses with a comma in between.)USE [msdb]GOEXEC msdb.dbo.sp_update_operator @name=N'DBAGroup2', @enabled=1, @pager_days=0, @email_address=N'TestEmail1@school.net;TestEmail2@school.net;TestEmail3@school.net', @pager_address=N'', @netsend_address=N''GO--NOTE: --The below code does NOT WORK when sending to a SQL Server Agent Operator's --Group (i.e. DBAGroup2) with more than one email address.--Send_Mail_via_DBMail.sqlEXEC msdb.dbo.sp_send_dbmail@recipients='DBAGroup2', --(Does Not Work)@body= 'Test Email Body', @subject = 'Test Database Email',@profile_name = 'TestDB Administrator Profile',@file_attachments = 'D:\DBA Scripts\AlterDatabases\Alter_Database_Options.sql'This is the Error Message, located in the Database Mail Log is:"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2013-07-29T16:09:15). Exception Message: Cannot send mails to mail server. (A recipient must be specified.)."I thought I had this working via the GUI (SQL Server Agent, double click a Job, click the Notification Page) with an older version of SQL Server (2005 I believe). I had Jobs set up that would send emails to an Operator Group which contained multiple individual Microsoft Exchange Email Addresses verses an Exchange Distribution Group. And thoughts? With SQL Server 2012 must we now use an Exchange Distribution Email?Thanks in advance, Kevin

Missing OraOLEDB provider

Posted: 29 Jul 2013 06:05 AM PDT

I need to be able to set up Linked Servers on our SQL Server 2012 Server. When I try to set up a new Linked server... I do not see the Oracle provider. I installed 64 bit Oracle client.... no go. I then installed 32 bit Oracle client in addition to 64 bit.... no go. I tried a Regedit hack I found on Google.... no go. I rebooted the server after each of the above attempts. Has anyone found a solution to this issue? Thank you in advance.Charlie

Error Log File Viewer

Posted: 29 Jul 2013 05:01 AM PDT

I've just configured a SQL Server 2012 and when I go to view the SQL Server Error Log through the log file Viewer the interface says No log source. By looking at the startup parameters I see the log file location and can see there are log files. It also lets me look at the log files through the file management system. Why doesn't the Log File Viewer work?

No comments:

Post a Comment

Search This Blog