Microsoft SQL Server 2008

49K

Solutions

23

Articles & Videos

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

I have a table (User_Values) where I need to create 613 rows of data into columns "User_ValueKey" (primary key) and User_Values (int).  The values are sequential, from 333 to 948.  The data would look like this in the table itself

User_ValueKey      User_Value
333                          333
334                          334
335                          335

And so forth.

Is there a quick way to do this?  I have SQL Server 2008 R2 Express, if that helps.

Thank you!
0
Free learning courses: Active Directory Deep Dive
LVL 1
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Hi experts
I have a Windows Server 2012 R2 - 64 bit, 32 GB RAM.
On this runs a SQL Server 2008 R2 Enterprise Edition 64 bit

The issue is that the sqlservr.exe service consumes almost 95% of memory (approx 28 GB).
I was checking and the configurations of min and max memory are not configured, I see the values like this:

Min server memory = 0
Max server memory = 2147483647
These are the default values.

My question is: what is the correct way or what should I take into account to give the appropriate values to my BD in relation to memory. Or how to tell if these 32GB of RAM I have is what I really need or are already running short.
0
Hello,
Can't figure out what is wrong with this SP.
The first condition does not fire at all.
 @tableName varchar(100) = null,
	 @ColumnName1 varchar(100) = null,
	 @ColumnName2 varchar(100) = null,
	 @ColumnName3 varchar(100) = null,
	 @Value varchar(100) = null,	
	 @Value2 varchar(100) = null
)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;  	
	
	   declare @SQL varchar(500) = null
	  -- NONCLUSTERED INDEX [NIX__UNQ__UID_]

	
          
			 	
			if  @ColumnName3 ='' 
				SET @SQL = 'SELECT DITINCT '  
			   
				SET @SQL = @SQL +  '[' +  @ColumnName1 + ']'  +  ' FROM  [' + @tableName + '] '   + ' WHERE  [' + @ColumnName2 + ']  LIKER ' +   '''' +'%' +  @Value + '%'+''''
	
	        if @ColumnName3 <> '' 
				SET @SQL = 'SELECT DISTINCT '  
	         

				SET @SQL = @SQL +  '[' +  @ColumnName1 + ']'  +  ' FROM  [' + @tableName + '] '   + ' WHERE   CAST(CollectionDateTime AS Date) =  ' +   '''' + @value  +''''  +
				 ' and   [' +  @ColumnName3 + ']   like ' +   '''' +'%'+  @Value2 +'%' +''''
	
	  SET @SQL = @SQL  	
	  
	  EXEC (@SQL)	
	  PRINT(@SQL)	
   

Open in new window


Cheers
0
Hi Experts ,

Today morning i have noticed below error .any thoughts on that how to solve the problem?

Error: 7884, Severity: 20, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
0
Hi experts
In May I had installed the sql server express with the ssdt. SSDT showed error, see attached file

In June a new installation was made and now I have the sql server 2012 developer
Microsoft SQL Server 2012 (SP3-GDR) (KB3194721) - 11.0.6248.0 (X64)
Sep 23 2016 15:49:43
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack

However the error is the same as it showed in May and I can not create packages in the SSIS
www.png
0
I need to know how much data travels (Send and Receive bytes per second) through my SQL server for a period of time (this can be a daily one)
this fact I need because I want to budget in Megas how much traffic we have in order to take the test database to the cloud (Azure).
0
I have 90 stored procedures and I would like to  grant  an EXECUTE permission to a user instead of manually doing it one by one.
What sql syntax or way to do it.
0
would both these syntax be exact and correct? what are pros/cons?
             
              SELECT count(*)
        FROM tableA
        INNER JOIN tableB
               ON A.key = B.Key
               AND EXISTS (SELECT col1 FROM tableC WHERE C.COL1 <> b.COL1 )
               
              SELECT count(*)
        FROM tableA
        INNER JOIN tableB
               ON A.key = B.Key
               AND B.col1 NOT IN (SELECT col1 FROM tableC)
               
               tableA has 3000 records.
              select distinct B.Col1 from tableB --9872
              select count(0) from tableB --9872
                            select count(1) from tableC --58M Records                            
select distinct COL1 from tableC --98003 Records
0
We have a nightly restore job that has been working flawlessly for years now. Recently, the restore has been hanging at 0 Percent Complete. (The database was taken offline prior to the restore. The status of the database never changes from offline to restoring).
Looking at the Activity Monitor, we are seeing that the restore is running with PREEMPTIVE_OS_FILEOPS wait types.

We are restoring from a DataDomain device. This is an intermittent problem. It works fine for 3 days, then it hangs up.
Rebooting the SQL Server clears up the issue (temporarily)

We are running SQL 2008 SP1 (Enterprise edition).
Our Data Domain device is a DD 2500 OS 5.7.2.0-532316

Has anyone experienced this?

Can anyone offer any tips as to what might be going on?

Thank you
0
for the query below:
SELECT count(*)
       FROM tableA
       INNER JOIN tableB
              ON A.key = B.Key
              AND B.col1 NOT IN (SELECT col1 FROM tableC)

                            currently, tableB has one [clustered, unique, primary key] index on col_x, Col1 (Col1 is in the condition)
                            tableC has one [clustered, unique, primary key] index on col_A,col_B, Col1  (Col1 is in the condition)
             
the condition is troublesome due to the big table. can you recommend on choosing appropriate index on B.Col1? or should it be on C.Col1?

but SELECT count(*)
       FROM tableA
       INNER JOIN tableB
              ON A.key = B.Key
returns in less than a second.(without condition)

stats below:

tableA has 3000 records.
              select distinct B.Col1 from tableB --9872
              select count(0) from tableB --9872
                            select count(1) from tableC --58M Records                            
select distinct COL1 from tableC --98003 Records
0
Transaction Monitoring Vs. Real User Monitoring
LVL 1
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Hello Experts
I currently have the license sql server 2012 enterprise, what problem could you have if it is under a standard. I currently only use database engine
0
in my work, I have a database user that belongs to the sysadmin role: it_support

When I create database user, these are created with all permissions, ie can view tables, run store procedure

My question is: why are they created with all the permissions?

In my house when I connect with my administrator account does not happen the same
0
The goal is to do a backup of a TDE database in Enterprise and take off encryption and thenbring a copy of standard edition.

When I ran this command
ALTER DATABASE oster
SET ENCRYPTION OFF
DROP DATABASE encryption key
and then ran this:
select * from sys.dm_database_encryption_keys  
the encryption_state status became '5', first for few minutes, and then became '1', but there was still an entry for that database in dm_database_encryption_keys .

now when i backup this new database from enterprise and restore it in standard edition, i get below:
Transparent Data Encryption is not available in the edition of this SQL Server instance. See books online for more details on feature support in different SQL Server editions.

how can we totally remove entry for that new database from dm_database_encryption_keys? maybe that is giving impression that TDE is still somewhere somehow present or
linked or alluded?

(when we create a brand new database, we dont see any entry for it in dm_database_encryption_keys). how can we bring this database to have no reference to any
entry in dm_database_encryption_keys?
0
This is SQL 2014

I have this sample data

create table #temp
(
   rowId int identity,
   cId int,
   year int,
   rank int,
   cName varchar(500)
)
 
 
 
insert into #temp
select 1, 1712, 2015,3,'test1'
 
insert into #temp
select 2, 1929, 2015,2302,'test2'
 
insert into #temp
select 3, 1712, 2014,1,'test1'
 
insert into #temp
select 3, 1929, 2014,2024,'test2'

Open in new window


I get 4 row. This is how I want it to look like. (I wanted to loop thru the #temp table, compare the "cid" and then maybe concat and dump the result into another table but that can't be the correct way of doing this)

I need the data in "Rank" column to be from earliest year (2014) to latest year (2015)

CId                           Year                                        Rank                              Cname

1712                    2014,2015               1,3                                  test1

1929                     2014, 2015                           2024,2302                              test2
0
hi experts

I have a table with 100,000 records, as I should modify it to support temporary system tables

this create code
CREATE TABLE dbo.Manager
( ManagerId int NOT NULL PRIMARY KEY,
  ManagerName nvarchar(50) NOT NULL,
  ManagerPassword varbinary(200) NOT NULL,
  ValidFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL,
  ValidTo datetime2 GENERATED ALWAYS AS ROW END NOT NULL,
  ChangedBy sysname NOT NULL CONSTRAINT DF_Employee_ChangedBy DEFAULT  (SUSER_SNAME()),
  PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo)
) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.ManagerHistory));
GO

But my table already exists and has data, so my question is: how do I modify the table
0
when a backup from SQL 2012 enterprise is placed in a Standard edition for RESTORE,

Database1)
Database cannot be started in this edition of SQL Server because part or all of object 'SOSPgrm' is enabled with data compression or vardecimal storage format. Data compression and vardecimal storage format are only supported on SQL Server Enterprise Edition.
 
Database2)
Transparent Data Encryption is not available in the edition of this SQL Server instance. Part or all of object 'tblDDLProgram' is enabled with data compression or vardecimal storage format. Data compression and vardecimal storage format are only supported on SQL Server Enterprise Edition.

can you recommend a way to work around this?
is it possible to make a RESTORE in the enterprised edition with different names, then remove the features on those databases and then BACKUP/RESTORE TO standard edition?
0
I have 50+ Views in SQL server and while connecting to the same server via Crystal Reports, I can only see top 12 Views (the top 12 that names start with letter "A").
How can I see all Views?
0
string TName = Request.ServerVariables["LOGON_USER"];

            if (TName.Contains(@"KATYISD\"))
            {
                TName = TName.Substring(TName.LastIndexOf(@"\") + 1);
            }


"Select * from dbo.teDataBases where Network_ID = "; TName

TName = 'keithwilson'
0
CREATE DATABASE RLSDemo
go
USE RLSDemo
GO
CREATE USER Employee1 WITHOUT LOGIN;
GO
CREATE USER Employee2 WITHOUT LOGIN;
GO

As you may be able to create database users without login in a DB that is not contained
0
What Is Transaction Monitoring and who needs it?
LVL 1
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

if there is a query result and only in one column the result gets duplicated, is there a way to combine just that column details by seperated by commas

example:

1,2,3,4,5,'CODE1','Pennsyvania'
1,2,3,4,5,'CODE1','Ohio'
1,2,3,4,5,'CODE1','California'
18,0,3,4,5,'CODE12,'Nev'
2,11,3,4,5,'CODE3','CO'
4,22,6,4,5,'CODE4','Florida'
11,2,3,5,'CODE5','MN'

result to be:

1,2,3,4,5,'CODE1','Pennsyvania,Ohio,California'
18,0,3,4,5,'CODE2','Nev'
2,11,3,4,5,'CODE3','CO'
4,22,6,4,5,'CODE4','Florida'
11,2,3,5,'CODE5','MN'

the query format is
SELECT <8 columns>
from
4 InnerJoins
WHERE 3 Conditions

can you guide how to just concatenate the specific column if there are more than one row for a specific code?
0
i have this query

SELECT col_1
            ,SUM(CAST([COL_13] AS decimal(28,2))) as DEBE
            ,SUM(CAST([COL_14] AS decimal(28,2))) as HABER
FROM [dbo].[CuentaCorriente_2015]
GROUP BY col_1

i test from
SUM(CAST([COL_13] AS decimal(10,2))
.
.
.
.
SUM(CAST([COL_13] AS decimal(28,2))

but always error is
Msg 8114, Level 16, State 5, Line 3
Error converting data type varchar to numeric.
cuenta_corrient.txt
0
As I can determine the first parameter of the decimal data type, sometimes I had to put 10 and sometimes I put the value of 11, I did a lot of tests. There is some function that allows me to determine the value of the first parameter x of the decimal (x, y)

select PERIODO, SUM(CAST(DEBE AS decimal(10,2))) AS DEBE_MENSUAL,
            SUM(CAST(HABER AS decimal(10,2))) AS HABER_MENSUAL
FROM [dbo].[Octubre]
WHERE ISNUMERIC(DEBE)=1 AND ISNUMERIC(HABER) = 1
GROUP BY PERIODO


UNION ALL
select PERIODO, SUM(CAST(DEBE AS decimal(11,2))) AS DEBE_MENSUAL
            , SUM(CAST(HABER AS decimal(11,2))) AS HABER_MENSUAL
FROM [dbo].[Diciembre]
WHERE ISNUMERIC(DEBE)=1 AND ISNUMERIC(HABER) = 1
GROUP BY PERIODO
0
this query
select PERIODO, SUM(CAST(DEBE AS decimal(10,2))) AS DEBE_MENSUAL,
            SUM(CAST(HABER AS decimal(10,2))) AS HABER_MENSUAL
FROM [dbo].[Mayo]
GROUP BY PERIODO

has errror
Error converting data type varchar to numeric.
0
I have a table with a columns datatype TEXT

I am trying to run an update ...
If I do the select on it the data comes up

It just won't update.

UPDATE dbo.cmsEmailTemplates
SET    Qualifications = replace(CAST(Qualifications AS VARCHAR(MAX)), '[NOTCOSTART]', '[QUALNOTCOSTART]')
WHERE  Qualifications LIKE '%[NOTCOSTART]%'
0
I have the entire contents of a table, with headers, in a CSV file.

How do I import it into a file?

Thanks.
0

Microsoft SQL Server 2008

49K

Solutions

23

Articles & Videos

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.