Viewing 15 posts - 2,446 through 2,460 (of 3,957 total)
ch.omkarreddy (11/21/2012)
yeah planned about same one thanks but could you please provide me a query as i am a beginner in sql server
You need to provide DDL and sample data...
November 21, 2012 at 11:04 pm
Would this work?
DECLARE @DB VARCHAR(100) = 'MyDB'
SELECT *
FROM @DB.sys.check_constraints
If not, why would it work in dynamic SQL?
Obviously, you've found an approach that does work though.
November 21, 2012 at 10:52 pm
ch.omkarreddy (11/21/2012)
if any insertions are done then the inserted data and modified id should be automatically generated in master table
It can be done with a cross-schema trigger, but that is...
November 21, 2012 at 10:46 pm
Change the COLLATE for one of the columns.
Try this:
create table my_table(id1 nvarchar(10), id2 varchar(10))
SELECT TABLE_NAME, COLUMN_NAME,CHARACTER_SET_NAME, COLLATION_NAME
FROM information_schema.columns
WHERE TABLE_NAME = 'my_table'
insert into my_table VALUES ('-1','-1');
insert into my_table VALUES ('1','1');
SELECT MAX(id1...
November 21, 2012 at 10:41 pm
Jeff Moden (11/21/2012)
dwain.c (11/21/2012)
Jeff Moden (11/21/2012)
November 21, 2012 at 9:12 pm
Jeff Moden (11/21/2012)
And, look Ma! No WHILE loop!Nice Crosstab and Modulus, Dwain.
Aw shucks, Master. T'weren't nuthin'!:blush:
November 21, 2012 at 8:22 pm
Jeff Moden (11/21/2012)
November 21, 2012 at 8:20 pm
Jeff Moden (11/21/2012)
I don't believe that COLLATE will help a STUFF (but I haven't tested it). Logically speaking, it should only help when string comparisons are being made.
I didn't...
November 21, 2012 at 7:42 pm
Call me weird or whatever but I don't think this is particularly messy at all using a simple cross tab query.
First, Michael's set up data with a couple of additional...
November 21, 2012 at 7:06 pm
Try it like this:
DECLARE @Valid_PolicyId INT
DECLARE @PolicyIdInput VARCHAR(100) = '222222222222222222222'
DECLARE @PolicyID INT
DECLARE @Err INT = 0
--check if PolicyId inputed--
IF ISNULL(@PolicyIdInput, '') = ''
BEGIN
RAISERROR ('Policy...
November 21, 2012 at 6:42 pm
sapen (11/21/2012)
Is this possible?
Sure! Anything is possible in the SQLverse. Assuming of course that when you say "consecutive" the Date column controls this. Try the following:
CREATE TABLE #Test(
[Date]...
November 21, 2012 at 6:12 pm
How about something like this?
;WITH Amounts AS (
SELECT CurrentLine, Amount, RowNumber, [Difference]=CAST(0 AS FLOAT)
,[Rows Subtracted]=CAST('N/A' AS VARCHAR(13))
...
November 21, 2012 at 5:42 pm
Eugene Elutin (11/21/2012)
Here we go!...
Actually, there is another aspect of using STUFF in Dwain's style - it does change collation of original string, which may not be appropriate sometimes.
Eugene Elutin...
November 21, 2012 at 5:27 pm
Eugene,
If you're going to cast aspersions on my code with garbage data, I think you should first look to your own. Try this:
select
SUBSTRING(email, CHARINDEX('.', email)+1,CHARINDEX('@', email)-CHARINDEX('.', email)-1)
...
November 21, 2012 at 7:16 am
Eugene Elutin (11/21/2012)
PRINT 'Dwain.C COLLATE + CROSS APPLY'
SET STATISTICS TIME ON
SELECT @Email=RIGHT(
STUFF(a.email
...
SELECT email...
November 21, 2012 at 3:21 am
Viewing 15 posts - 2,446 through 2,460 (of 3,957 total)