Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Microsoft SQL Server 2008

49K

Solutions

17K

Contributors

Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the  Always On technologies and support for unstructured data types.

Share tech news, updates, or what's on your mind.

Sign up to Post

My task is to archive records from these original tables to the archive tables as shown below; however the original tables have foreign keys define and table 2 has no date to be used in the INSERT where clause predicate -12 week. what would be your approach here, can you give me the directions and script.  thanks,
 



      Original Tables

(1)
CREATE TABLE [dbo].[JSServicesCheckListLog](
         [ServiceLogID],
      FK-[CSC],
      FK-[ServiceTypeID],
         [Comments],
         [ChecklistCompletedDate],
         [ChecklistCompletedBy],
         [CleaningDate],
         [NoShow],

(2)
CREATE TABLE [dbo].[JSServiceChecklistDetailsLog](
      PK-[ServiceDetailsLogId],
      FK-[ServiceLogID],
      FK-[ServiceWorkAreaDetailsID],
      FK-[RatingID],
         [Comments],



      Archive Tables

(1)
CREATE TABLE [Archive].[JSServicesCheckListLog](
      [JSServicesCheckListLogID],
      [ServiceLogID],
      [CSC],
      [ServiceTypeID],
      [Comments],
      [ChecklistCompletedDate],
      [ChecklistCompletedBy],
      [CleaningDate],
      [NoShow],
      [LastUpdateTimestamp],


                         
(2)

CREATE TABLE [Archive].[JSServiceChecklistDetailsLog](
      [JSServiceChecklistDetailsLogID],
      [ServiceDetailsLogId],
      [ServiceLogID],
      [ServiceWorkAreaDetailsID],
      [RatingID],
      [Comments],
      [LastUpdateTimestamp],
0
Upgrade your Question Security!
LVL 11
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

While i try to copy data from one table to another table in sql server 2008 i am getting below error.

There is already an object named 'table123' in the database.

Just i am copying this table to another database.

i already created schema in another database with same table name.
0
SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0x00000000; actual signature: 0x00000000). It occurred during a read of page (1:4825942) in database ID 5 at offset 0x000009346ac000 in file 'G:\DATA1\MSSQL\Data\AdMail50_Data.mdf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

Please help me how to fix.
0
Hi Team,

SQL DB corrupted i want to rename this db and restore from backup.
But this DB is part of Transactional Replication.
Please suggest.
0
SQL-MPSQL-MPHello,

Question on SQL 2008 backup files when using a manual backup process (right-click on database, choose "Tasks" -> "Backup") versus using a maintenance plan in SQL Server Management Studio.

I've noticed that when I use a SQL 2008 maintenance plan the backup files for a particular database, the .bak is only ~ 9 GB. But when I manually backup this same database by right-clicking on the database entry and choosing "Tasks" -> "Backup" that the .bak file is ~ 18 GB. I've confirmed the maintenance plan is targeting the correct database, and the MDF and LDF files are approximately 9 GB and 2 GB respectively. Screenshot of the maintenance plan structure is attached.

Could this be considered normal?

Thank you in advance.

Jason
0
hi all.  I need to compare source_table with target_table.  if target table has same rows as source then delete the those rows from target, and then insert the new  rows from source into target.  What is the best way to do this?  I tried merge but I am having issues.

thanks!
0
I have a request of how to write an Execute SQL task in SSIS.   More of a fail safe for when a vendor's file does not make it to our system.    This is causing the below issue.

I have a SQL job Step 1 that successfully uploads a CSV File from a WINSCP Windows task script to retrieve the latest CSV file from a SFTP site.   Then the SQL job Step 2 sends the file to the SSIS package for loading into SQL.   The problem occurs when the SFTP site does not receive a new file.  
Step 1 does not fail because it successfully retrieved the latest file, however, Step 2 using the package fails because the file that was pulled already exists from the previous pull.   I need a way to check in the SSIS package to see if the dynamically named CSV file exists before processing.    I am very green to writing variables and I have never used the Script task command.  Is there a way to do this check before my package kicks off the For each file task by using the Execute SQL task  ?    

As a side note, I do not have permissions to delete older files off of the SFTP site.    And, even though the SQL Job Step 2 says it failed, it still executes the CSV file so now I have duplicate records for the same day.

Please advise exact steps as I am a beginner.
0
hi,

what are differences between index rebuild vs index reorg while getting statistics

when to use which one. Advantages, disadvantages of each

please advise.
0
hi,

when we use below optins like

verify backup integrity and
 set up back up compression

what it mean by setting
 set up back up compression  to server level?
how defragmentation different from decompression?
please advise
0
Am trying to Automate log Shipping for 900 DB's which are on 3 instances.

What is the best way to automate the log shipping configuration

Below blog script used SQL CMD to configure log shipping for 1 DB, but i need to change it to all the DB's on the instance.

https://stackoverflow.com/questions/4127668/scripting-log-shipping-automation

Appreciate your inputs.
0
Free Tool: IP Lookup
LVL 11
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi
I am looking for a simple solution to replicate production 2008 SQL DB's  into Lab 2008 SQL  server continuously..

Can someone recommend a simple solution to do this please?

Thanks
0
I have several  Maintenance Plans that I am moving from one server to another 69 to be exact, I need to change the server connection string on the DTX package. I  know I can do it by opening each package as it is XML and do a find and replace but that is very tedious. I have tried the following code but it doesn't change the connection string.
use msdb
 
DECLARE @oldservername as varchar(max)
SET @oldservername='AMCHARAPP1\DYNAMICSGP'
 
-- set the new server name to the current server name
 
declare @newservername as varchar(max)
set @newservername= 'AMCHARAPP2'
 
declare @xml as varchar(max)
declare @packagedata as varbinary(max)
-- get all the plans that have the old server name in their connection string
DECLARE PlansToFix Cursor
FOR
SELECT    id
FROM         sysssispackages
WHERE     (CAST(CAST(packagedata AS varbinary(MAX)) AS varchar(MAX)) LIKE '%server=''' + @oldservername + '%')
 
OPEN PlansToFix
 
 
declare @planid uniqueidentifier
fetch next from PlansToFix into @planid
 
while (@@fetch_status<>-1)  -- for each plan
 
begin
if (@@fetch_status<>-2)
begin
select @xml=cast(cast(packagedata as varbinary(max)) as varchar(max)) from sysssispackages where id= @planid  -- get the plan's xml converted to an xml string
 
declare @planname varchar(max)
select @planname=[name] from  sysssispackages where id= @planid  -- get the plan name
print 'Changing ' + @planname + ' server from ' + @oldservername + ' to ' + @newservername  -- print out what change is happening
 
set

Open in new window

0
I am try to connect conquestdicomserver with sql Server 2008 R2 manually and also trying to editing "dicom.ini" file.. but this is not working..

Any One can help me..please.... Thanks in Advances

Here is DICOM.INI file code .

i am using window32

Sql Server Name :- GMDahri-PC
databse    Name :- conquest
login         Name :- conquest
password            :- conquest1415
sa                        :- 123




# This file contains configuration information for the DICOM server
# Do not edit unless you know what you are doing

[sscscp]
MicroPACS                = sscscp

# Network configuration: server name and TCP/IP port#
MyACRNema                = NICVDPACS
TCPPort                  = 5678

# Host(ignored), name, username and password for ODBC data source
SQLHost                  = localhost
SQLServer                = conquestpacs_s
Username                 = conquest
Password                 = conquest1415
DoubleBackSlashToDB      = 0
UseEscapeStringConstants = 0

# Configure server
ImportExportDragAndDrop  = 1
ZipTime                  = 05:
UIDPrefix                = 1.2.826.0.1.3680043.2.135.736588.40949073
EnableComputedFields     = 1

FileNameSyntax           = 4

# Configuration of compression for incoming images and archival
DroppedFileCompression   = un
IncomingCompression      = un
ArchiveCompression       = as

# For debug information
PACSName                 = NICVDPACS
OperatorConsole          = 127.0.0.1
DebugLevel…
0
MY QUERY IS
SHOW DATABASES;

THEN SHOW  ERROR

Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'SHOW'.  
   WHY SHOW THIS ERROR PLZ HELP ME.
0
Hi,

I wanted to understand what will be the impact of performance on server if i set Max Pool size =500 and Connection Lifetime=60 seconds in connection string specified in web.config

Is it dangerous to set connection max pool size as well as connection lifetime=60s ? I added this configuration as I was getting exception thrown for default connection max pool size i.e 200 so had to increase it to 500 though i am closing my connection properly as explained in other forums as well as Microsoft docs?

Thanks,

Krutik Sheth
0
We have a sql cluster using 2008R2. When running on one node of the cluster, our SSRS reports are fine. When running on the other node, the reports are extremely slow. For example, we have a 350 page report that the first node can print to pdf in about 30 seconds. The same report take at least an hour on the second node. As a test, I installed sql server and SSRS on my laptop. I can print the same large report also in under a minute.
So what could be happening on the second server that slows printing down so much? It doesn't matter whether we are printing to paper, pdf, etc. Also, it happens with any of our reports. It is not limited to this one large one. It also happens whether there are images  on the report or not.
0
What statement would you use to remove all rows from a table
0
Hi,
I have created user and given permssion to  db_owner for Test database.
But user complaining user can't create stored procedure or View.
I have given grant using following command but still user can't create store procedure.
What iam missing

use [App_Test]
GRANT EXECUTE ON SCHEMA::[dbo] TO [user1]
GRANT EXECUTE ON DATABASE:: App_Test  TO [user1]

USE  [App_Test]
GRANT CREATE PROCEDURE TO [user1]    
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, EXECUTE, VIEW DEFINITION ON SCHEMA::dbo TO [user1]
0
Hi there,
   We have log shipping for 4 databases which are going well but however only Restore Jobs for two databases gets failed in DR environment occasionally. The error message says like this
Executed as user: xxxxxxxxx. The process could not be created for step 1 of job 0x867837754D077D4A9BFF608D000072BD (reason: 5).  The step failed.

I have configured the Job->Step->Advanced->output file to capture the error message but this error was not written in the output file as well. In fact this error doesn't seem to be happened at all as I can see the output file has only log which is written before the last run which was failed.

thanks
Deepak
0
[Webinar] Database Backup and Recovery
LVL 11
[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Hi,
I have create user "qry" and create table Sales.
I need to give access this user only sales year 2017, i don't want to show 2016<= sales.
How to do that?
Best regards
0
I've inherited a linked server which drives our website. I recently discovered that not all of our replications to that linked server are complete. I'm missing sometimes thousands of records in some tables. I think what is happening is that some of the local publications never had subscriber jobs created so the snapshots are being created, but not moved to the linked server. When I try to create a new subscription job I get an error  that the "subscription to publication <xxxx> has expired or does not exist."

How do I even begin to resolve this? Google searches are only telling me how to create the subscription but doesn't really help resolve this specific issue.

I'll provide whatever additional information you need. The full error is here:
Date            6/28/2017 9:26:59 AM
Log            Job History (SQL12-ItemMaster-repl1_Cat_to_Opt-WIN-3EB9B225E5P-1069)

Step ID            2
Server            SQL12
Job Name            SQL12-ItemMaster-repl1_Cat_to_Opt-WIN-3EB9B225E5P-1069
Step Name            Run agent.
Duration            00:00:01
Sql Severity      0
Sql Message ID      0
Operator Emailed      
Operator Net sent      
Operator Paged      
Retries Attempted      0

Message
2017-06-28 14:26:59.919 Copyright (c) 2008 Microsoft Corporation
2017-06-28 14:26:59.919 Microsoft SQL Server Replication Agent: replmerg
2017-06-28 14:26:59.919
2017-06-28 14:26:59.919 The timestamps prepended to the output lines are expressed in terms of UTC time.
2017-06-28 14:26:59.919 User-specified agent parameter values:
                  -Publisher SQL12
                  -PublisherDB …
0
The Server (win 2008) name for one of our test Server was changed , however, the server hosted an SQL Database. with the change, it has resulted in us unable to connect to the SQL Database (sql 2008). the previous username does not work anymore and i even tried connecting with windows authentication and still nothing. is there anyway to resolve this?

Regards,
Grand
0
Hello Experts,
I am trying to debug a Stored Procedure and I get the following error as soon as I Start Debugging.  Any idea what is going on?

Error Message:  Unable to start T-SQL debugging. Could not attach to sql server process on XXX.  The object exporter specified was not found.

Thank you in advance!
0
I have many columns in my report and I want to dynamically sort the columns which the user needed to sort in ascending order. How could this be done?
0
I am using MS SQL Server 2008 as my Database and I created a Stored Procedure that looks like this.

    USE [DB_Question]
    GO
   
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER Procedure [dbo].[Check_ExamID]
    @ExamID NVARCHAR(MAX)
    as
    SELECT * FROM TBL_ExamTimer WHERE ExamID = @ExamID

and here is my PHP code that suppost to be the target is to display data in my PHP site by using some criteria also.

    <html>
    <head>
   
    </head>
    <body>
    <?php
   
          include('config.php');
          include('adodb/adodb.inc.php');
          $db = ADONewConnection($dbdriver);
          $db->Connect($dsn, $username, $password);
          
          $procedure = $db->prepareSp('Check_ExamID');
          if (!$procedure)
        die ('Invalid or inaccessible stored procedure name');
          
          $parameter1Name = '@ExamID';
          $ok = $db->inParameter($procedure,$parameter1Name,'1234');
          $result = $db->execute($procedure);
     
   
    ?>
    </body>
    </html>

I am trying to display data where `ExamID =@ExamID` or `1234` for param of `@ExamID`

My Target here is to use my stored procedure to select data in my table and return it back in my php file but nothings happening. TYSM
0

Microsoft SQL Server 2008

49K

Solutions

17K

Contributors

Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the  Always On technologies and support for unstructured data types.