Tag: sql-server-2008-r2

Exposing SQL Data to clients

we have an internal SQL Server 2008R2 db that we’d like to expose (partially – only some tables) to our clients via Internet, so they can feed their Excel reports. What are our best options? How should we provide security (ie. Should we create another, staging DB server on DMZ for this?). As far as […]

How to split a row into many equals rows by a value in a column?

There is any way to dismember a row into many rows by a value into row column? Doing my query, i got the result: ID TmpShoppingCart_ID StoreSKU_ID QuantityΞΞ Enabled 26 34 448 2 True 27 34 3465 4 True 28 34 3468 1 True But I want: ID TmpShoppingCart_ID StoreSKU_ID QuantityΞΞ Enabled 26 34 448 […]

Combining data in rows with the same key

My sql statement looks like this. SELECT fe.AdmSiteID,A.SiteDescription, ” AS SNAP, ” AS TANF, ” AS Foster, ” AS FDPIR, ” AS Homeless, ” AS Migrant, ” AS Runaway, ” AS HeadStart, ” AS EvenStart, ” AS DirectCertified, ” AS NoApplication, ” AS FreeIncome, ” AS ReducedIncome, ” AS RefusedBenefits,” AS DeniedIncome, ” AS DeniedVerification, […]

Operator BETWEEN in SQL Server

I was writing sub query in stored procedure to get the values between Orders stored as varchar datatype. When i run the query it shows: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. […]

Trying to use a VB Script in an SSIS package to get the Server name from a connection

I’m writing an SSIS package that uses VB Scripts to send several confirmation emails. One of the confirmation emails needs to have the name of the server from one of the connection managers. I have a script doing the following: Public Sub Main() ‘————- Set Vriables Dim htmlMessageTo As String = _ Dts.Variables(“Email_To”).Value.ToString Dim htmlMessageCC […]

ladder-like record selection without looping

I have a table like this, A and B as columns: A B 1 0 2 1 3 2 4 3 A record can be selected by defining a value for A. If the selected row has a value for B, the row whose A’s value is equal to the record’s B must also be […]

Insufficient result space to convert uniqueidentifier value to char. Temp table Error

Error: Insufficient result space to convert uniqueidentifier value to char. I have a temp table SELECT urlid, — This coulmn does not exist in Phrase table I would like to declare it uniqueidentifier P.subDomainId, P.RegionID INTO #tempcom FROM Phrase P When i Update #tempcom table with this query Declare @urlid as uniqueidentifier Set @urlid = […]

How output data from database to table?

Good afternoon. I am want select the data from the database to next table: structure database: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[ExPRoG_Statistic_banners]( [id] [int] IDENTITY(1,1) NOT NULL, [user_id] [varchar](50) NULL, [banner_idn] [varchar](50) NULL, [banner_page] [varchar](150) NULL, [action] [varchar](50) NULL, [datetime] [datetime] NULL, [server_referer] [varchar](150) NULL, [ip] […]

How to drop table PK if I do not know its name

I try to drop primary key: alter table mytable DROP ( SELECT CONSTRAINT_NAME FROM information_schema.table_constraints where table_name=’mytable’ and constraint_type = ‘PRIMARY KEY’) How to do it correctly?

SQL server – can connect via remote server but not local machine – why?

I am able to login to a remote server and connect to a database on another server from there. When I do the same thing from my local machine it fails, giving me the error below – A connection was successfully established with the server, but then an error occurred during the login process. (provider: […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.