SQL Server Admin 2014 :: Create Dynamic Columns In Temp Table?

Jun 9, 2014

I want to generate dynamic temp table so, from one strored procedure am getting an some feilds as shown below

CM_id,CM_Name,[Transaction_Month],[Transaction_Year],''[Invoice raised date],''[Payment Received date],''[Payout date],''[Payroll lock date]

for i want to generate table for the above feilds with datatype

View 5 Replies


ADVERTISEMENT

SQL Server Admin 2014 :: Crystal Report Cannot Select Into Temp Table

Jul 30, 2015

I know select * into ##tmp1 should work but I get a database connection error.

View 9 Replies View Related

SQL Server Admin 2014 :: Create Temporary Table With Dynamics Column

Jun 10, 2014

I have created a stored procedure for retrieving column name, as shown below

CM_id, CM_Name, [Transaction_Month], [Transaction_Year], [Invoice raised date],[Payment Received date],[Payout date],[Payroll lock date]

Now I am trying to create a temporary table using the above generated coluimns from Stored Procedure with datatype.

View 3 Replies View Related

SQL Server Admin 2014 :: Execute Dynamic Query 1 As A Transaction

Feb 7, 2015

I have this command :

Exec 'update .... insert ..... delete ..... insert ...'

I Execute these command in one execution.
exec ('...')

Are these commands act as a transaction? If one of them create error , another commands run or rull backed?

View 1 Replies View Related

SQL Server Admin 2014 :: Selected Columns On View

Mar 18, 2015

I have created row level security on two views and adding these two views to particular role.Today I have got an requirement that, middle level managers shouldn't see the all the columns. So I have created another role for Middle level managers and assign securables as those two views with selected columns by grant, and map all the middle level managers to this role. I thought my job is done. But these managers uses this view on SSAS(tabular model) and Excel, In those applications they are not able to load the data.

Later I come to know we can't use -- select * from ViewA ( in viewA I have restristced few columns in the role level) Work around is creating another view and assigning to the role. But how can we achieve column level security to implement this in either SSAS/SSRS/EXCEL?

View 6 Replies View Related

SQL Server Admin 2014 :: Unable To Create Credentials

Jul 23, 2014

What is the needed permission to create credential except for sysadmin?

Already granted securityadmin but still user does not have permission to perform this action.

View 1 Replies View Related

SQL Server Admin 2014 :: Create Format File For BCP

Nov 10, 2014

We have one table where we store all documents in one of the column called "Doc" with varbinary(max) data type.

We want to download those documents from sql table to windows explorer and i wrote BCP in sql 2005. And things were fine.

The format file I used there looks like this,

9.0
1
1 SQLBINARY 0 0 "" 1 Doc ""

Now we are in 2014 and when I try the same code with same format file, it hangs in the middle. So I changed the file to 12.0 instead of 9.0 but still not working.

View 0 Replies View Related

SQL Server Admin 2014 :: Create A Master Key In The Database

Jun 15, 2015

in my environment I am running the SQL Server agent job.i am getting below message.

create a master key in the database or open a master key in the session before performing this operation” error 

View 5 Replies View Related

SQL Server Admin 2014 :: Create Three AGs And Listeners In Same Instance

Jul 28, 2015

I have built a SQL 2014 Always on Cluster. I need to create three Availability groups and listeners in the same instance. Do I need 3 separate IP address for each listener or one IP address can be shared for all 3 Listeners ?

View 3 Replies View Related

SQL Server Admin 2014 :: Can't Create Model After Clean MDS Install

Apr 17, 2015

I have made a clean install of SQL 2014 including MDS on a server with Win Server 2012 R2.

After the installation I cant create new models because on an error saying that "Must declare the scalar variable "@Version_Id". "

I can see that the tables gets created in the MDS database but the models dont show up in the web interface.

I get the same error message when I try to deploy an old model.

View 0 Replies View Related

How To Create Dynamic Columns In A Temporary Table

Sep 5, 2007

Hi there,
i have a requirement that a temporary table contains dynamic columns depending on where condition.

my actual table is like





Key
Value


X1
x

X3
x

X5
x

Y1
y

Y2
y
when user select x, the input variable passed to stored proc and the result is shown like

column names
X1 X3 X5 as column headers.

the select query is from temporary table.

these out put is based on the user selection. so the temporary table created with columns dynamically.

please help me out.
please let me know if you didn't understand.

thanks
Praveen.

View 7 Replies View Related

SQL Server 2014 :: Pivot IN Clause - Dynamic Columns

May 12, 2015

The first select is running fine but due to extra values added to the table the list of manual difined columns must be added manualy each time new values occur.

Is it possible to make the PIVOT's IN clause dynamicly as stated in the second script (it is based on the same table #source) when running it prompts the next error;

Msg 156, Level 15, State 1, Line 315
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 315
Incorrect syntax near ')'.

adding or moving ')' or '(' are not working.......

select *
into #temp
from #source
pivot ( avg(value) for drive in ([C], [D], [E], [F], [G], [H], [T], [U], [V] )) as value
select * from #temp order by .........

versus

select *
into #temp
from #source
pivot ( avg(value) for drive in (select distinct(column) from #source)) as value

select * from #temp order by .....

View 3 Replies View Related

SQL Server Admin 2014 :: Cannot Decrypt Encrypted Columns From Database Backup On Local Machine

Jun 29, 2015

I've a SQL server 2014 running on one of our server. We're in the process of implementing security steps for our databases. I've encrypted a column in one of the table in the database on the server. The issue is when I restore the backup on my local SQL server and run a query to decrypt the column data it gives me null values. On the other end when I decrypt the column data on the main server it works fine. I found a thread on this forum which states to do the following when restoring the encrypted database on different server.

USE [master];
GO
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'StrongPassword';
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY;
GO

select File_Name
, CONVERT(nvarchar,DECRYPTBYKEY(File_Name))
from [test].[dbo].[Orders_Customer]

I tried doing above still no luck.

View 3 Replies View Related

SQL Server Admin 2014 :: How To Close Active Connections Or Create Connection Timeouts

Dec 9, 2014

we have roughly 22 people connected to one database. But after a while, their applications begin to drag due to in and out communication with the server. When i check the active connections on the sql server, some times i see 157 active connections, please how to i set a timeout or connection interval close, so as reduce the heavy load being put on the server. Or how can i automatically close connections when they get higher than 50 connections.

This settings should be sql server 2008 related.

View 5 Replies View Related

SQL Server 2014 :: UNION ALL In View With Temp Table

May 8, 2015

I have a performance issue with one of the views when I join the view with a temp table

I have 2 Views - View1 and View2.

There is a third view - view_UNION where the

view_UNION =
SELECT * FROM View1
UNION ALL
SELECT * FROM View2

If I have a query like -

Select view_UNION.* FROM
view_UNION INNER JOIN #TMP ON #TMP.ID = view_UNION.ID

the execution is too slow.

But if I execute the views separately, I get good performance.

How to improve the performance of the view_Union

View 7 Replies View Related

SQL Server Admin 2014 :: Insert A Row To A Table Based On Table Values?

Jun 10, 2015

Here is my table:

My question is: How can I insert a row for each unique TemplateId. So let's say I have templateIds like, 2,5,6,7... For each unique templateId, how can I insert one more row?

View 0 Replies View Related

SQL Server Admin 2014 :: Add New Column To A Table

Aug 24, 2015

I am new in SQL Server, What to check ,what action do i need to take while adding a new column to a table.

View 5 Replies View Related

SQL Server Admin 2014 :: Few Record Loss In Table Primary Key Where Same Records Exists In Foreign Key Table?

Jun 21, 2015

Previously same records exists in table having primary key and table having foreign key . we have faced 7 records were lost from primary key table but same record exists in foreign key table.

View 3 Replies View Related

SQL Server 2014 :: Creating A Table With Updatable Columns And Read-only Columns

May 26, 2015

Here is My requirement, I'm not sure if this is possible. Creating table called master like col1, col2 col3, col4 , col5 ...Where Col1, col2 are updatable - this can be done easily

Col3, col4 are columns in another table but these can be just a read only ?? Is this possible ? this is possible with View but not friendly with share point CRUD...Col 5 is a computed column of col 2 and col5 ? if above step can be done then sure this can be done I guess.

View 4 Replies View Related

SQL Server Admin 2014 :: Backup Of Indexes For A Particular Table?

Aug 9, 2014

how to take backup of indexes for a particular table.

View 1 Replies View Related

SQL Server Admin 2014 :: Backup Of Indexes For A Particular Table

Aug 9, 2014

How to take backup of indexes for a particular table.

View 5 Replies View Related

SQL Server Admin 2014 :: TDE Table Data Encryption?

Jun 8, 2015

I'm having problems with the following code:

--DROP MASTER KEY
--GO
USE master;
CREATE MASTER KEY
ENCRYPTION BY PASSWORD = 'Pass@word1';
GO
USE master;

[code]....

What am I missing? What do I have to do if I get in a situation where I need to back out and start over?

[URL]

View 9 Replies View Related

SQL Server Admin 2014 :: Identify Who Dropped A Table

Jun 30, 2015

I'm getting a replication error that an object (Table) was not found. Any script that can capture this information?

View 3 Replies View Related

SQL Server Admin 2014 :: Filegroup By Table Category

Oct 14, 2015

I'm being asked to create multiple filegroups for a new database based on the table type, transaction, lookup, misc... From what i'm reading this doesn't make sense. I'm reading either large tables get file groups, nonclustered indexes when they are about the same size of the data, or a few other reasons...

First of all, we are talking about the same disk (please don't ask me about how it is configured) and I'm not sure yet if restoring separate file groups is even going to be necessary.

So here are my questions (beyond, the test and see what happens) because in the end I'm going to probably have to do what i'm told. So this is for my professional knowledge.

1. Does file groups separated by table type make sense?
2. Should you put tables that are queried often together in the same or different file groups.
3. I'm pretty sure you can't restore single file group for write access, am I correct?

View 0 Replies View Related

SQL Server Admin 2014 :: Replicating Data To A Table Via A View

Aug 11, 2014

I am trying to replicate data from a view in the publisher to a table in the subscriber (transaction replication). I do not need the view's base table, or the view itself, replicated to the subscriber. I only want to data from the view to feed a table in the subscriber.

Is this possible?

Running SQL Server 2008 R2 Enterprise.

View 1 Replies View Related

SQL Server Admin 2014 :: Heap Table Fragmentation Is Higher Than 50

Dec 1, 2014

I have bunch of heap tables and the fragmentation seems to be high, i am not sure whether i shall add index for them, as these tables are inserted and updated every day.

View 4 Replies View Related

SQL Server Admin 2014 :: Restoring A Single Table From Backup

Dec 12, 2014

With all the new functionality, can 2014 now restore a single table from a standard backup without using any third party tools? I have looked, but can't see this listed as a feature (though that doesn't mean it's not there, maybe I've just missed it).

View 6 Replies View Related

SQL Server Admin 2014 :: Master Table With Insert Trigger

Feb 4, 2015

I have a master table with after insert trigger on it.. When record is inserted into master table, the trigger fires and is captured in the backoffice table. In case the trigger fails, my record is neither in the master table nor in the back office table..

Is there anyway to capture the record either in the master table or in a separate table.

View 6 Replies View Related

SQL Server Admin 2014 :: Table Size Difference In Two Database

Jul 20, 2015

I am having an issue in determining the correct size of a table.

I have a tableA in some DB on transaction server (Enterprise Edition), this table is being replicated in reporting server DB (Standard edition).

When I check the space used by this table in both the databases i see noticeable difference.

I am using EXEC sp_spaceused 'tableA' to determine the space.

Transaction Server
------------------------------------------------------------------------------
name rows reserveddata index_size unused
TableA1439999 695416 KB507048 KB182912 KB 5456 KB

Reporting Server
-------------------------------------------------------------------------------
name rows reserveddata index_size unused
TableA1439999 656904 KB483664 KB172680 KB 560 KB

So I wanted to know what could be the possible reasons for this difference ?

View 5 Replies View Related

SQL Server Admin 2014 :: List Of Users That Accessed A Table

Jul 22, 2015

I'm trying to find out what tables are being used in a Database.

I don't want the last User but the User and the Dates.

I have a script that return the last user but that is not going to work.

The following script returns the last user but not all users and the Login Name:

ITH LastActivity (ObjectID, LastAction) AS
(
SELECT object_id AS TableName,
last_user_seek as LastAction
FROM sys.dm_db_index_usage_stats u
WHERE database_id = db_id(db_name())

[Code] .....

View 2 Replies View Related

SQL Server Admin 2014 :: Can Lock Table Only For Specific User For Some Seconds

Apr 8, 2015

I need to do some operations on a table when any user dont work with it.How do i do it?Do i lock the table? and is it possible?

View 8 Replies View Related

SQL Server Admin 2014 :: Scheduled Job Runs Successfully But Table Does Not Update

Jun 25, 2015

I have a job scheduled that imports a table from a Oracle database. The job runs at 3am and reports success. But for some reason when i query the table to see how many records there are, I see the same row count as the day before (it should increase everyday- student enrollment). When i execute the package manually, the table updates fine.

SQL Server 2014/Win7 x64.

View 7 Replies View Related

SQL Server Admin 2014 :: Identify Table Made On Temporary Basis Are Not Used?

Sep 9, 2015

In the Operating environment databases, may be made tables in the database on a temporary basis but they are still yet and they are not removed, how to identify tables that have been made on a temporary basis are not used (don’t have any read & write records)?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved