Microsoft SQL Server

158K

Solutions

187

Articles & Videos

48K

Contributors

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

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

Sign up to Post

My C# application is showing ominous behaviour.

The application is working perfectly fine for a specific Installation. But it's giving me this exception in another..
- SqlDataAdapter.Fill - Timeout expired.  The timeout period elapsed Prior to executing the query or the Server is not responding.

I've been searching all day for a solution and cant find anything helpful.

The c# Code is

            DataTable dt = new DataTable(tableName);
            try
            {
                using (SqlDataAdapter da = new SqlDataAdapter(SqlQuery, conn))
                {
                    Console.Write(SqlQuery);
                    da.Fill(dt);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Foo String there is nothing good Happening {0}", ex.ToString()));
            }

Open in new window


The SQL is : SELECT * FROM FooTable WHERE ColumnA=0 and ColumnB='15'

Every Google post I've been looking at is about "increase your command timeout". Which makes me almost give up hope.

The same SQL in SSMS Returns only 1 row and I've seriously no idea what is going on.

I've attached a Debugger to the process and can definitely say the code is reaching the Console.Write as a breakpoint.
The exception is thrown at the fill method line.

I'm highly thankful for any responses.
0
How our DevOps Teams Maximize Uptime
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Hello experts,


I have a table with id, k, v (id is is, k is key, and v is value)

like :

id           k            v                        <--- columns in a select * fron tempTable
------------------------
A            k1           1
A            k2           2
A            k3           3
B            k1           1
B            k2           2
B            k3           3

SO what I want to do is 

Return the data as a crosstable/PIVOR/something else:

id         k1       k2       k3
-------------------------------------     
A          1         2       3
B          1         2       3

Open in new window


PIVOT not working on earlier versions of oracle database and I want a simple still reliable solution.
I really don't want to use ms access to make a crosstable for this :D
0
I am trying to import a file that is using a "Unit Separator" ... ASCII Value 31 ... as its delimiter.  I am struggling with how to specify that value in a format file.  I have tried many different values but none seem to work.  Anyone run into this before and have a solution?  My last attempt is shown below:


11.0
10
1       SQLCHAR             2       50      "\0x1F"   1     ContextID                                        SQL_Latin1_General_CP1_CI_AS
2       SQLCHAR             2       50      "\0x1F"   2     ContextName                                      SQL_Latin1_General_CP1_CI_AS
3       SQLCHAR             2       50      "\0x1F"   3     ContextParentContextID                           SQL_Latin1_General_CP1_CI_AS
4       SQLCHAR             2       50      "\0x1F"   4     ClientRecordNumberID                             SQL_Latin1_General_CP1_CI_AS
5       SQLCHAR             2       50      "\0x1F"   5     PatientID                                        SQL_Latin1_General_CP1_CI_AS
6       SQLCHAR             2       75      "\0x1F"   6     CustomFieldName                                  SQL_Latin1_General_CP1_CI_AS
7       SQLCHAR             2       50      "\0x1F"   7     CustomFieldType                                  SQL_Latin1_General_CP1_CI_AS
8       SQLCHAR             2       125     "\0x1F"   8     CustomFieldValue                                 SQL_Latin1_General_CP1_CI_AS
9       SQLCHAR             2       50      "\0x1F"   9     …
0
I have been asked to migrate/update an Access/SQL Application so it can run in a VM Environment on a true SQL Server; I have a general understanding to get started, but this is my first VM project, so step one is to plan for the unexpected. I request that you treat me as a novice when making suggestions.

Rather than write a novel about the function of this Access/SQL Application and to minimize suppositions, I would rather respond to questions about it.

To start this off, here is the current configuration ...
Standalone Workstation
Windows 10 64 Bit
Access Pro Plus 2013 (Front End)
SQL 2016 Express (Back End)

What would be the best approach and what pitfalls should be anticipated?
0
Hi,

I've just been told I'm now in charge of and managing two SQL databases and have never used SQL before.

One of them we can remove as it is a backup and is no longer required. How do I safely back this up and then delete it so we can, if required, restore it?

Also: The db has a total size of 6,927Mb. 6021Mb of which is transaction log space. How do I go about reducing this log space? We are nowhere near using up the space allocated to logs but we are short on disk space on the server.

I've tried backing it up by doing a full backup and also a transaction log backup but no reduction in transaction log space.

So I'm looking for 3 things:

1) Reducing transaction log space
2) How to create a full backup that we can restore from
3) How to take the db offline and then delete it from Studio (assume Tasks > Offline, then delete)

Thanks and apologies for the noob questions but this has literally landed on my desk.
0
can any one write a code for me in php... for file uploding and files uploading
0
Dear Experts,

Based on your experience could you please advise in which scenarios worth to use this "SELECT in JOIN" technique:
SELECT
	t1.LIFNR AS VendorNumber,
	t1.NAME1 AS VendorName,
	SubQuery.BUKRS AS CompanyCode
FROM
	AP.LFA1 t1
INNER JOIN
	(SELECT AP.LFB1.LIFNR, AP.LFB1.BUKRS FROM AP.LFB1 WHERE AP.LFB1.BUKRS = 'SX1') SubQuery ON t1.LIFNR = SubQuery.LIFNR

Open in new window


instead of doing the same filtering in WHERE section?
SELECT
	AP.LFA1.LIFNR AS VendorNumber,
	AP.LFA1.NAME1 AS VendorName,
	AP.LFB1.BUKRS AS CompanyCode
FROM
	AP.LFA1
INNER JOIN
	AP.LFB1 ON AP.LFA1.LIFNR = AP.LFB1.LIFNR
WHERE
	AP.LFB1.BUKRS = 'SX1'

Open in new window


Thanks in advance,
0
I want to return the Top 5 vCount for/in each vGroup in this query, but I'm having trouble figuring out where to put it ?

		/****** Region ******/		
		SELECT	vGroup, vType, count(*) AS vCount
		FROM (
		SELECT        'Region visits' AS vGroup, Districts.name AS vType
		FROM             (v_Visits INNER JOIN Customers ON v_Visits.customerId = Customers.id) INNER JOIN Districts ON Customers.districtId = Districts.id
		WHERE        visitTime  between @periodFrom and dateadd(ms, -3, dateadd(day, 1, cast(@periodTo as datetime))) AND v_Visits.userRole like @uRole AND v_Visits.channelName like @channels
		) resSub
		GROUP BY  vGroup, vType

		/****** Brand ******/
		UNION ALL
		SELECT	vGroup, vType, count(*) AS vCount
		FROM(
		SELECT        'Brand visits' AS VGroup, Products.brandName as vType
		FROM            v_Visits INNER JOIN Visits_r_Products ON v_Visits.id = Visits_r_Products.visitId INNER JOIN Products ON Visits_r_Products.productId = Products.id
		WHERE        visitTime  between @periodFrom and dateadd(ms, -3, dateadd(day, 1, cast(@periodTo as datetime))) AND v_Visits.userRole like @uRole AND v_Visits.channelName like @channels
		) resSub
		GROUP BY  vGroup, vType

Open in new window

0
Hi EE,

I am sure this question would have been asked and answered here. But here is my requirements.

Drop all foreign key constraints in my db
Truncate all tables

Recreate all foreign key constraints. I have been trying to use https://social.technet.microsoft.com/wiki/contents/articles/2958.script-to-create-all-foreign-keys.aspx but somehow i am unable to make it work.

Can you please help?

regards
0
Hello,
How can I modify this query to have filter like' starts with '
  IF  @PatientName <> '' 	       
			 SET @SQL = @SQL + '  AND PatientName LIKE  ''%' + CAST(@PatientName AS  Nvarchar(MAX)) +  '%'''
   

Open in new window



Regards
0
Comprehensive Backup Solutions for Microsoft
LVL 4
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Since we upgraded to SQL 2008 from SQL 2000 i have faced the following problem: I can run the VB Script that runs a DTS from the SQL Server, however running the same VB Script to to execute the DTS from a client PC has the above error message. I have tried, installing MS SQL studio on the client connecting to the DB instance and tried running the VB Script but it still wont work. im lost, please help

Regards,
Grand
0
Hi All,

I have query below:

DECLARE @intMaxLength AS INTEGER
SET @intMaxLength  = (SELECT MAX(LEN(RTRIM(Name))) FROM TMJENIS)
SELECT
RTRIM(JenisCode) As JenisCode
 
,LEFT(Name, @intMaxLength) + SPACE(@intMaxLength  - LEN(RTRIM(Name))) + ' - ' + RTRIM(JenisCode) As Name
 
, LEN(Name) as lenname
, @intMaxLength as MAXLEN
FROM TMJENIS
WHERE 1=1
ORDER BY Name

Adding the SPACE(@intMaxLength  - LEN(RTRIM(Name)))  does not help.

What's wrong ?

Thank you.
0
Are there any list of requirements that must be in place for SSIS to show up in the program application list below. I would assume either a database must be present or is it a stand alone product in the list provide that I can point to a specific database to work on.

One of the members said Development licenses. I cannot afford one at the moment is there a trial or a way to get a free temporary license?
I think I just need as simple as I can get. I have weeks before I would start if I do get this opportunity. I think it will be time enough for me to catch up and get back into the swing of things. Reporting is what I do anyway. This is just a tool to clean up the data enhance performance and produce a result set to report off of.
SQL-Server-2016.jpg
0
I was thinking maybe Northwinds DB but there may be better. Any thoughts or links appreciated.
0
Currently we windows server 2008 R enterprise cluster. I would like to replace them with two new nodes Windows server 2016 standard. I have tried to added them to the existing cluster but failed.

Test result:
Validate operating system version ..warning
Network... failed
System configuration... failed
List Network Metric Order... failed
Walidate require services... failed

Regards
0
Dear Experts,

My client is using Symantec Backup Exec 2012

They have three servers to do the backup set at Highest (SQL) , High (Exchange) and Medium (Apps)

All servers are to backup at 11pm everyday. Mon to Thurs (incremental), Friday (Full)

The backup for Exchange and Apps server are successful.

But the SQL server is still running the backup but there is no action.
CKG-Backup1.JPG
CKG-Backup2.JPG
CKG-Backup3.JPG
CKG-Backup4.JPG
CKG-Backup5.JPG
0
Hi Experts,

I had this code working fine in a DSN based connection.
Set objRec = CreateObject("ADODB.Recordset")
Set objConn = CreateObject("ADODB.Connection")

objConn.ConnectionString = "Provider=MSDASQL;DSN=PlacementNP;Initial Catalog=PlacementNP;User Id=MyUser;Password=MyPWD"
objConn.Open

Open in new window


However now that we changed to a DSN-less connection I can't get it to work, tried the following
Set objRec = CreateObject("ADODB.Recordset")
Set objConn = CreateObject("ADODB.Connection")

objConn.ConnectionString = "ODBC;DRIVER=sql server;Server=tcp:sqlserver1\exp08;Database=PlacementNP;UId=MyUser;PWD=MyPWD;Trusted_Connection=No"
objConn.Open

Open in new window

And I get the attached error, when all the credentials are still the same.

Any idea what's wrong here?
Untitled.png
0
I have a person_name field with the value of eg, Smith, John but search method does not work using like. Is there any method?
I used this query but nothing is returned

I'm using this store proc with parameter @pname.

      SELECT personID,PERSONNAME FROM [dbo].[VW_UNION]
      WHERE ,PERSONNAME  LIKE UPPER(RTRIM(LTrim(@pname + '%')))
Because, the person name is split by "," , it there to execute a query and look for the first string before the  first ','  ?
0
SQL server sends an email to a customer using Office365.
Message Trace from Microsoft shows the message being accepted by Google.
Google sends a message to the sender saying the message is being delayed.
After days of delays the message fails with this error

write error: generic::failed_precondition: write error (0): error
0
Get 15 Days FREE Full-Featured Trial
LVL 1
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

In MS Access 2010 a user is encountering the message "ODBC Call Failed" when trying to preview a report. The data source for the report is a linked table from SQL Server 2008 R2. Another user using this same machine can execute the report preview without any issue. Guessing here that there is a SQL Server security issue with the user that is having difficulty. However I can find no obvious difference in the SQL Security between the two. The ODBC bridge is set up the same for both users as a Trusted Connection. Any idea what the issue might be here ? Not sure how to troubleshoot this. Thanks.
0
Am a bit clueless as to how to code this, please help.
we need to first convert the special characters to code before sending out some email address to a third party vendor.
The characters that need to be encoded and their translations are as follows:
Character      Encoded
!      %21
#      %23
$      %24
%      %25
&      %26
'      %27
*      %2A
+      %2B
/      %2F
=      %3D
?      %3F
^      %5E
`      %60
{      %7B
\      %7C
}      %7D
However, there might be more characters that need encoding. Instead of replacing these characters manually, a better method would be to replace all characters that are not 0-9, a-z, or A-Z with their hex value. You can retrieve this value using SELECT CONVERT(VARBINARY(MAX), '!') = 0x21 ( = %21), for example.
with an email address such as email+address@domain.com, the + becomes a space character when clicking on the URL.
Instead, the + (and other valid characters) needs to be encoded to properly pass the email address to the page.
In the above example, the + should be %2B, making it email%2Baddress@domain.com.
0
Hi Expert,

One of my user requested me to access on the integration services and i gave him access on MSDB database db_ssisadmin  but he is getting the error. Error is attached. I suggested him to run SSMS as an administrator but didn't work for him.

Please help!
_error.jpg
0
I am new to SQL server, I have a Stored procedure that returning only almost 1733 rows but taking long time to execute.Please find the stored procedure below and help me to get increase the performance I am using MS SQL Server 2012 I am unable to attache test result and execution plan
TEST_SP.txt
0
It would appear that SSIS is now called SSDT. Is that correct?

I need to learn as much simple functionality as I can of SSIS by Friday for an interview opportunity. The largest one I have ever had.
Then I need to brush up on my SQL Server Query abilities. Which are old and rusty. Any thoughts on how I can get caught up quickly?
I understand the concepts of both products and have used SQL Server in the past just need any input so that I can snag a job. Please advise. Thank you.
0
Hi EE,

I am trying to add a security group to a SQL Server I can find the group without issue when I search via Windows -> Computer Management but I can't that same group to display in SQL server. See screenshot I have triple checked the names and locations where I am searching.

Any assistance is welcome.


Thank you.
Search-Screen.PNG
0

Microsoft SQL Server

158K

Solutions

187

Articles & Videos

48K

Contributors

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.